本文整理汇总了Java中org.springframework.data.redis.core.ScanOptions类的典型用法代码示例。如果您正苦于以下问题:Java ScanOptions类的具体用法?Java ScanOptions怎么用?Java ScanOptions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScanOptions类属于org.springframework.data.redis.core包,在下文中一共展示了ScanOptions类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: findSignUpCodeByUsername
import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public UUID findSignUpCodeByUsername(String username) {
String foundSignUpCodeKey = redisTemplate.execute(new RedisCallback<String>() {
@Override
public String doInRedis(RedisConnection connection) throws DataAccessException {
try (Cursor<byte[]> cursor = connection.scan(
ScanOptions.scanOptions().match("signup:signupcode*").build())) {
while (cursor.hasNext()) {
String key = new String(cursor.next(), "UTF-8");
String usernameFromRedis = (String) redisTemplate.opsForHash().get(key, "username");
if (username.equals(usernameFromRedis)) {
return key;
}
}
} catch (IOException e) {
throw new FlexPokerException("error in Redis");
}
throw new FlexPokerException("could not find username in Redis");
}
});
return UUID.fromString(foundSignUpCodeKey.split(":")[2]);
}
开发者ID:cwoolner,项目名称:flex-poker,代码行数:24,代码来源:RedisSignUpRepository.java
示例2: scan
import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<TypedTuple<V>> scan(K key, final ScanOptions options) {
final byte[] rawKey = rawKey(key);
Cursor<Tuple> cursor = execute(new RedisCallback<Cursor<Tuple>>() {
@Override
public Cursor<Tuple> doInRedis(RedisConnection connection) throws DataAccessException {
connection.select(dbIndex);
return connection.zScan(rawKey, options);
}
}, true);
return new ConvertingCursor<Tuple, TypedTuple<V>>(cursor, new Converter<Tuple, TypedTuple<V>>() {
@Override
public TypedTuple<V> convert(Tuple source) {
return deserializeTuple(source);
}
});
}
开发者ID:mauersu,项目名称:redis-admin,代码行数:22,代码来源:DefaultZSetOperations.java
示例3: scan
import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<V> scan(K key, final ScanOptions options) {
final byte[] rawKey = rawKey(key);
return execute(new RedisCallback<Cursor<V>>() {
@Override
public Cursor<V> doInRedis(RedisConnection connection) throws DataAccessException {
return new ConvertingCursor<byte[], V>(connection.sScan(rawKey, options), new Converter<byte[], V>() {
@Override
public V convert(byte[] source) {
return deserializeValue(source);
}
});
}
}, true);
}
开发者ID:mauersu,项目名称:redis-admin,代码行数:20,代码来源:DefaultSetOperations.java
示例4: clear
import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@ManagedOperation(description = "Clear the store")
@Override
public void clear() {
valueOperations.getOperations().execute(new RedisCallback<List<byte[]>>() {
@Override
public List<byte[]> doInRedis(RedisConnection connection) throws DataAccessException {
List<byte[]> binaryKeys = new ArrayList<>();
Cursor<byte[]> cursor = connection.scan(ScanOptions.scanOptions().match("*" + createRedisKey("*")).build());
while (cursor.hasNext()) {
byte[] key = cursor.next();
binaryKeys.add(key);
}
if (binaryKeys.size() > 0) {
connection.del(binaryKeys.toArray(new byte[][]{}));
}
return binaryKeys;
}
});
}
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:RedisStringIdempotentRepository.java
示例5: iterateOverKeysMatchingPrefixUsingScanCommand
import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
/**
* Uses {@code SCAN} command for loading all matching keys. <br />
* {@code SCAN} uses a cursor on server side returning only a subset of the available data with the possibility to
* ripple load further elements using the cursors position. <br />
* All keys will be loaded using <strong>multiple</strong> operations.
*/
@Test
public void iterateOverKeysMatchingPrefixUsingScanCommand() {
generateRandomKeys(1000);
Cursor<byte[]> cursor = this.connection.scan(ScanOptions.scanOptions().match(KEY_PATTERN).build());
printKeys(cursor);
}
开发者ID:Just-Fun,项目名称:spring-data-examples,代码行数:15,代码来源:KeyOperationsTests.java
示例6: scan
import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<Entry<HK, HV>> scan(K key, final ScanOptions options) {
final byte[] rawKey = rawKey(key);
return execute(new RedisCallback<Cursor<Map.Entry<HK, HV>>>() {
@Override
public Cursor<Entry<HK, HV>> doInRedis(RedisConnection connection) throws DataAccessException {
return new ConvertingCursor<Map.Entry<byte[], byte[]>, Map.Entry<HK, HV>>(connection.hScan(rawKey, options),
new Converter<Map.Entry<byte[], byte[]>, Map.Entry<HK, HV>>() {
@Override
public Entry<HK, HV> convert(final Entry<byte[], byte[]> source) {
return new Map.Entry<HK, HV>() {
@Override
public HK getKey() {
return deserializeHashKey(source.getKey());
}
@Override
public HV getValue() {
return deserializeHashValue(source.getValue());
}
@Override
public HV setValue(HV value) {
throw new UnsupportedOperationException("Values cannot be set when scanning through entries.");
}
};
}
});
}
}, true);
}
开发者ID:mauersu,项目名称:redis-admin,代码行数:41,代码来源:DefaultHashOperations.java
示例7: scan
import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<Entry<Object, Object>> scan(String key, ScanOptions options) {
throw new UnsupportedOperationException("Unsupported method");
}
开发者ID:davidgamez,项目名称:parrot-rest,代码行数:5,代码来源:HashOperationsMock.java
示例8: scan
import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<byte[]> scan(ScanOptions options) {
return redisConnection.scan(options);
}
开发者ID:1991wangliang,项目名称:tx-lcn,代码行数:5,代码来源:AbstractRedisConnection.java
示例9: sScan
import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<byte[]> sScan(byte[] key, ScanOptions options) {
return redisConnection.sScan(key, options);
}
开发者ID:1991wangliang,项目名称:tx-lcn,代码行数:5,代码来源:AbstractRedisConnection.java
示例10: zScan
import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<Tuple> zScan(byte[] key, ScanOptions options) {
return redisConnection.zScan(key, options);
}
开发者ID:1991wangliang,项目名称:tx-lcn,代码行数:5,代码来源:AbstractRedisConnection.java
示例11: hScan
import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<Map.Entry<byte[], byte[]>> hScan(byte[] key, ScanOptions options) {
return redisConnection.hScan(key, options);
}
开发者ID:1991wangliang,项目名称:tx-lcn,代码行数:5,代码来源:AbstractRedisConnection.java
示例12: scan
import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<V> scan(ScanOptions options) {
return ops.scan(getKey(), options);
}
开发者ID:mauersu,项目名称:redis-admin,代码行数:5,代码来源:DefaultBoundSetOperations.java
示例13: scan
import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<Entry<HK, HV>> scan(ScanOptions options) {
return ops.scan(getKey(), options);
}
开发者ID:mauersu,项目名称:redis-admin,代码行数:5,代码来源:DefaultBoundHashOperations.java
示例14: scan
import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<TypedTuple<V>> scan(ScanOptions options) {
return ops.scan(getKey(), options);
}
开发者ID:mauersu,项目名称:redis-admin,代码行数:5,代码来源:DefaultBoundZSetOperations.java
示例15: getStartOptions
import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
/**
* 前缀
* @param prefix
* @return
* @since 1.0
*/
public static ScanOptions getStartOptions(String prefix) {
return ScanOptions.scanOptions().match("^" + prefix + ".*").build();
}
开发者ID:ccfish86,项目名称:sctalk,代码行数:10,代码来源:RedisKeys.java
示例16: getEndOptions
import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
/**
* 后缀
* @param suffix
* @return
* @since 1.0
*/
public static ScanOptions getEndOptions(String suffix) {
return ScanOptions.scanOptions().match(".*" + suffix + "$").build();
}
开发者ID:ccfish86,项目名称:sctalk,代码行数:10,代码来源:RedisKeys.java
注:本文中的org.springframework.data.redis.core.ScanOptions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论