jedis scan实现keys功能
/** * key模糊查找 * * @param keys 要查找的key 例: aaa* ,aaa开头的所有key * @return 匹配到的key集合 */ public Set<String> keys(String keys) { TreeSet<String> set = new TreeSet<>(); try (Jedis jedis = getJedis()) { String cursor = ScanParams.SCAN_POINTER_START; ScanParams scanParams = new ScanParams().match(keys).count(10000); do { ScanResult<String> scan = jedis.scan(cursor, scanParams); set.addAll(scan.getResult()); cursor = scan.getCursor(); } while (!ScanParams.SCAN_POINTER_START.equals(cursor)); } catch (Exception e) { log.error(e); } return set; }