当前位置: 首页>>代码示例>>Java>>正文


Java ScanParams.match方法代码示例

本文整理汇总了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;
    }
}
 
开发者ID:jigsaw-projects,项目名称:jigsaw-payment,代码行数:23,代码来源:RedisTemplate.java

示例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;
	}
}
 
开发者ID:nince-wyj,项目名称:jahhan,代码行数:27,代码来源:Redis.java

示例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;
	}
}
 
开发者ID:nince-wyj,项目名称:jahhan,代码行数:29,代码来源:Redis.java

示例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;
	}
}
 
开发者ID:nince-wyj,项目名称:jahhan,代码行数:27,代码来源:Redis.java

示例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;
	}
}
 
开发者ID:nince-wyj,项目名称:jahhan,代码行数:29,代码来源:Redis.java

示例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()));
}
 
开发者ID:mindwind,项目名称:craft-atom,代码行数:8,代码来源:DefaultRedis.java

示例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;
    }
  }
}
 
开发者ID:apache,项目名称:beam,代码行数:29,代码来源:RedisIO.java

示例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;
}
 
开发者ID:y-lan,项目名称:presto,代码行数:30,代码来源:RedisRecordCursor.java

示例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");
}
 
开发者ID:Netflix,项目名称:dyno,代码行数:30,代码来源:DynoJedisDemo.java

示例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());
}
 
开发者ID:mindwind,项目名称:craft-atom,代码行数:8,代码来源:DefaultRedis.java

示例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());
}
 
开发者ID:mindwind,项目名称:craft-atom,代码行数:8,代码来源:DefaultRedis.java

示例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());
}
 
开发者ID:mindwind,项目名称:craft-atom,代码行数:8,代码来源:DefaultRedis.java

示例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());
}
 
开发者ID:mindwind,项目名称:craft-atom,代码行数:7,代码来源:DefaultRedis.java

示例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());
}
 
开发者ID:mindwind,项目名称:craft-atom,代码行数:7,代码来源:DefaultRedis.java


注:本文中的redis.clients.jedis.ScanParams.match方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。