本文整理汇总了Java中redis.clients.jedis.ScanParams.match方法的典型用法代码示例。如果您正苦于以下问题:Java ScanParams.match方法的具体用法?Java ScanParams.match怎么用?Java ScanParams.match使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类redis.clients.jedis.ScanParams
的用法示例。
在下文中一共展示了ScanParams.match方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scanHSet
import redis.clients.jedis.ScanParams; //导入方法依赖的package包/类
/**
* 全局扫描hset
*
* @param match field匹配模式
*/
public List<Map.Entry<String, String>> scanHSet(String domain, String match) {
try (ShardedJedis shardedJedis = shardedJedisPool.getResource()) {
int cursor = 0;
ScanParams scanParams = new ScanParams();
scanParams.match(match);
Jedis jedis = shardedJedis.getShard(domain);
ScanResult<Map.Entry<String, String>> scanResult;
List<Map.Entry<String, String>> list = new ArrayList<Map.Entry<String, String>>();
do {
scanResult = jedis.hscan(domain, String.valueOf(cursor), scanParams);
list.addAll(scanResult.getResult());
cursor = Integer.parseInt(scanResult.getStringCursor());
} while (cursor > 0);
return list;
}
}
示例2: scan
import redis.clients.jedis.ScanParams; //导入方法依赖的package包/类
/**
* 返回指定数量的匹配值
*
* @param cursor
* @param count
* @param patterns
* @return
*/
public ScanResult<String> scan(final String cursor, final Integer count, final String... patterns) {
ScanParams params = new ScanParams();
for (String pattern : patterns) {
params.match(pattern);
}
if (null != count) {
params.count(count);
}
if (RedisConstants.isInUse()) {
return getTemplate().execute(new JedisCallBackHandler<ScanResult<String>>() {
public ScanResult<String> invoke(Jedis jedis) {
return jedis.scan(cursor, params);
}
});
} else {
return null;
}
}
示例3: hscan
import redis.clients.jedis.ScanParams; //导入方法依赖的package包/类
/**
* 命令用于迭代哈希键中的键值对
*
* @param key
* @param cursor
* @param count
* @param patterns
* @return
*/
public ScanResult<Entry<String, String>> hscan(final String key, final String cursor, final Integer count,
final String... patterns) {
ScanParams params = new ScanParams();
for (String pattern : patterns) {
params.match(pattern);
}
if (null != count) {
params.count(count);
}
if (RedisConstants.isInUse()) {
return getTemplate().execute(new JedisCallBackHandler<ScanResult<Entry<String, String>>>() {
public ScanResult<Entry<String, String>> invoke(Jedis jedis) {
return jedis.hscan(key, cursor, params);
}
});
} else {
return null;
}
}
示例4: scan
import redis.clients.jedis.ScanParams; //导入方法依赖的package包/类
/**
* 返回指定数量的匹配值
*
* @param cursor
* @param count
* @param patterns
* @return
*/
public ScanResult<String> scan(final String cursor, final Integer count, final String... patterns) {
ScanParams params = new ScanParams();
for (String pattern : patterns) {
params.match(pattern);
}
if (null != count) {
params.count(count);
}
if (RedisConstants.isInUse()) {
return getTemplate().executeRead(new JedisCallBackHandler<ScanResult<String>>() {
public ScanResult<String> invoke(Jedis jedis) {
return jedis.scan(cursor, params);
}
});
} else {
return null;
}
}
示例5: hscan
import redis.clients.jedis.ScanParams; //导入方法依赖的package包/类
/**
* 命令用于迭代哈希键中的键值对
*
* @param key
* @param cursor
* @param count
* @param patterns
* @return
*/
public ScanResult<Entry<String, String>> hscan(final String key, final String cursor, final Integer count,
final String... patterns) {
ScanParams params = new ScanParams();
for (String pattern : patterns) {
params.match(pattern);
}
if (null != count) {
params.count(count);
}
if (RedisConstants.isInUse()) {
return getTemplate().executeRead(new JedisCallBackHandler<ScanResult<Entry<String, String>>>() {
public ScanResult<Entry<String, String>> invoke(Jedis jedis) {
return jedis.hscan(key, cursor, params);
}
});
} else {
return null;
}
}
示例6: zscan_match_count
import redis.clients.jedis.ScanParams; //导入方法依赖的package包/类
private ScanResult<Map.Entry<String, Double>> zscan_match_count(Jedis j, String key, String cursor, String pattern, int count) {
ScanParams param = new ScanParams();
param.match(pattern);
param.count(count);
redis.clients.jedis.ScanResult<Tuple> sr = j.zscan(key, cursor, param);
return new ScanResult<Map.Entry<String, Double>>(sr.getStringCursor(), convert(sr.getResult()));
}
示例7: processElement
import redis.clients.jedis.ScanParams; //导入方法依赖的package包/类
@ProcessElement
public void processElement(ProcessContext processContext) throws Exception {
ScanParams scanParams = new ScanParams();
scanParams.match(processContext.element());
String cursor = ScanParams.SCAN_POINTER_START;
boolean finished = false;
while (!finished) {
ScanResult<String> scanResult = jedis.scan(cursor, scanParams);
List<String> keys = scanResult.getResult();
Pipeline pipeline = jedis.pipelined();
if (keys != null) {
for (String key : keys) {
pipeline.get(key);
}
List<Object> values = pipeline.syncAndReturnAll();
for (int i = 0; i < values.size(); i++) {
processContext.output(KV.of(keys.get(i), (String) values.get(i)));
}
}
cursor = scanResult.getStringCursor();
if (cursor.equals("0")) {
finished = true;
}
}
}
示例8: setScanParms
import redis.clients.jedis.ScanParams; //导入方法依赖的package包/类
private ScanParams setScanParms()
{
if (split.getKeyDataType() == RedisDataType.STRING) {
ScanParams scanParms = new ScanParams();
scanParms.count(redisJedisManager.getRedisConnectorConfig().getRedisScanCount());
// when Redis key string follows "schema:table:*" format
// scan command can efficiently query tables
// by returning matching keys
// the alternative is to set key-prefix-schema-table to false
// and treat entire redis as single schema , single table
// redis Hash/Set types are to be supported - they can also be
// used to filter out table data
// "default" schema is not prefixed to the key
if (redisJedisManager.getRedisConnectorConfig().isKeyPrefixSchemaTable()) {
String keyMatch = "";
if (!split.getSchemaName().equals("default")) {
keyMatch = split.getSchemaName() + Character.toString(redisJedisManager.getRedisConnectorConfig().getRedisKeyDelimiter());
}
keyMatch = keyMatch + split.getTableName() + Character.toString(redisJedisManager.getRedisConnectorConfig().getRedisKeyDelimiter()) + "*";
scanParms.match(keyMatch);
}
return scanParms;
}
return null;
}
示例9: run
import redis.clients.jedis.ScanParams; //导入方法依赖的package包/类
@Override
public void run() {
int keyValue;
while (run) {
scanParams = new ScanParams();
scanParams.match(dchConfiguration.getJedis_prefix() + "*");
// scanParams.match("*");
ScanResult<String> scanResult = connector.getJedis().scan("0", scanParams);
List<String> keys = scanResult.getResult();
Iterator<String> keyIterator = keys.iterator();
System.out.println(keys.size() + " Anzahl KEYS");
while (keyIterator.hasNext()) {
String id = keyIterator.next();
keyValue = connector.getIntValueForKey(id);
valueUpdateEvent = new ValueUpdateEvent(this.world);
valueUpdateEvent.setValue(keyValue);
valueUpdateEvent.setId(id);
MinecraftForge.EVENT_BUS.post(valueUpdateEvent);
}
if (myMap.isEmpty()) updateTimeRange();
setTime();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
System.err.println(e.getMessage());
}
}
}
开发者ID:digital-crafting-habitat,项目名称:dch_hack1ng_d4ys_workshop,代码行数:36,代码来源:ControllerRefreshThread.java
示例10: runSScanTest
import redis.clients.jedis.ScanParams; //导入方法依赖的package包/类
public void runSScanTest(boolean populateKeys) throws Exception {
logger.info("SET SCAN TEST -- begin");
final String key = "DynoClientTest_Set";
if (populateKeys) {
logger.info("Populating set in cluster {} with key {}", this.clusterName, key);
for (int i = 0; i < 50; i++) {
client.sadd(key, "value-" + i);
}
}
logger.info("Reading members of set from cluster {} with key {}", this.clusterName, key);
ScanResult<String> scanResult;
final Set<String> matches = new HashSet<>();
String cursor = "0";
do {
final ScanParams scanParams = new ScanParams().count(10);
scanParams.match("*");
scanResult = client.sscan(key, cursor, scanParams);
matches.addAll(scanResult.getResult());
cursor = scanResult.getStringCursor();
if ("0".equals(cursor)) {
break;
}
} while (true);
logger.info("SET SCAN TEST -- done");
}
示例11: scan_match_count
import redis.clients.jedis.ScanParams; //导入方法依赖的package包/类
private ScanResult<String> scan_match_count(Jedis j, String cursor, String pattern, int count) {
ScanParams param = new ScanParams();
param.match(pattern);
param.count(count);
redis.clients.jedis.ScanResult<String> sr = j.scan(cursor, param);
return new ScanResult<String>(sr.getStringCursor(), sr.getResult());
}
示例12: hscan_match_count
import redis.clients.jedis.ScanParams; //导入方法依赖的package包/类
private ScanResult<Map.Entry<String, String>> hscan_match_count(Jedis j, String key, String cursor, String pattern, int count) {
ScanParams param = new ScanParams();
param.match(pattern);
param.count(count);
redis.clients.jedis.ScanResult<Map.Entry<String, String>> sr = j.hscan(key, cursor, param);
return new ScanResult<Map.Entry<String, String>>(sr.getStringCursor(), sr.getResult());
}
示例13: sscan_match_count
import redis.clients.jedis.ScanParams; //导入方法依赖的package包/类
private ScanResult<String> sscan_match_count(Jedis j, String key, String cursor, String pattern, int count) {
ScanParams param = new ScanParams();
param.match(pattern);
param.count(count);
redis.clients.jedis.ScanResult<String> sr = j.sscan(key, cursor, param);
return new ScanResult<String>(sr.getStringCursor(), sr.getResult());
}
示例14: scan_match
import redis.clients.jedis.ScanParams; //导入方法依赖的package包/类
private ScanResult<String> scan_match(Jedis j, String cursor, String pattern) {
ScanParams param = new ScanParams();
param.match(pattern);
redis.clients.jedis.ScanResult<String> sr = j.scan(cursor, param);
return new ScanResult<String>(sr.getStringCursor(), sr.getResult());
}
示例15: hscan_match
import redis.clients.jedis.ScanParams; //导入方法依赖的package包/类
private ScanResult<Map.Entry<String, String>> hscan_match(Jedis j, String key, String cursor, String pattern) {
ScanParams param = new ScanParams();
param.match(pattern);
redis.clients.jedis.ScanResult<Map.Entry<String, String>> sr = j.hscan(key, cursor, param);
return new ScanResult<Map.Entry<String, String>>(sr.getStringCursor(), sr.getResult());
}