@Test public void testKeys() { Set<String> keys = JedisManager.keys("lo*"); assertTrue("Should contain key 'lol'", keys.contains(key)); }
public static Set<String> keys(String pattern) { try (Jedis jedis = instance.getJedis()){ if (jedis == null) { return Collections.emptySet(); } return jedis.keys(pattern + "*"); } catch(JedisConnectionException e) { log.error("Failed to run KEYS", pattern); return null; } catch (Exception e) { log.error("Running KEYS", pattern + "on Redis failed:", e.getMessage()); return null; } }
JedisManager { public static Set<String> keys(String pattern) { try (Jedis jedis = instance.getJedis()){ if (jedis == null) { return Collections.emptySet(); } return jedis.keys(pattern + "*"); } catch(JedisConnectionException e) { log.error("Failed to run KEYS", pattern); return null; } catch (Exception e) { log.error("Running KEYS", pattern + "on Redis failed:", e.getMessage()); return null; } } }
JedisManager { public static Set<String> keys(String pattern) { try (Jedis jedis = instance.getJedis()){ if (jedis == null) { return Collections.emptySet(); } return jedis.keys(pattern + "*"); } catch(JedisConnectionException e) { log.error("Failed to run KEYS", pattern); return null; } catch (Exception e) { log.error("Running KEYS", pattern + "on Redis failed:", e.getMessage()); return null; } } private  JedisManager(); }
JedisManager { public static Set<String> keys(String pattern) { try (Jedis jedis = instance.getJedis()){ if (jedis == null) { return Collections.emptySet(); } return jedis.keys(pattern + "*"); } catch(JedisConnectionException e) { log.error("Failed to run KEYS", pattern); return null; } catch (Exception e) { log.error("Running KEYS", pattern + "on Redis failed:", e.getMessage()); return null; } } private  JedisManager(); static void connect(final int poolSize, final String host, final int port); static void shutdown(); void release(); Jedis getJedis(); Jedis getJedis(boolean throwException); static String getNecessary(String key); static String get(String key); static String get(String key, boolean throwException); static byte[] get(byte[] key); static String setex(String key, int seconds, String value); static String setex(byte[] key, int seconds, byte[] value); static Set<String> keys(String pattern); static Set<String> hkeys(String key); static String hget(String key, String field); static Long hset(String key, String field, String value); static Long del(String... keys); static Long delAll(String key); static long getValueStringLength(String key); static long pushToList(String key, String ...values); static String popList(String key); static String popList(String key, boolean head); static Long publish(final String channel, final String message); static void subscribe(final JedisSubscriber subscriber, final String channel); }
JedisManager { public static Set<String> keys(String pattern) { try (Jedis jedis = instance.getJedis()){ if (jedis == null) { return Collections.emptySet(); } return jedis.keys(pattern + "*"); } catch(JedisConnectionException e) { log.error("Failed to run KEYS", pattern); return null; } catch (Exception e) { log.error("Running KEYS", pattern + "on Redis failed:", e.getMessage()); return null; } } private  JedisManager(); static void connect(final int poolSize, final String host, final int port); static void shutdown(); void release(); Jedis getJedis(); Jedis getJedis(boolean throwException); static String getNecessary(String key); static String get(String key); static String get(String key, boolean throwException); static byte[] get(byte[] key); static String setex(String key, int seconds, String value); static String setex(byte[] key, int seconds, byte[] value); static Set<String> keys(String pattern); static Set<String> hkeys(String key); static String hget(String key, String field); static Long hset(String key, String field, String value); static Long del(String... keys); static Long delAll(String key); static long getValueStringLength(String key); static long pushToList(String key, String ...values); static String popList(String key); static String popList(String key, boolean head); static Long publish(final String channel, final String message); static void subscribe(final JedisSubscriber subscriber, final String channel); static String ERROR_REDIS_COMMUNICATION_FAILURE; static final int EXPIRY_TIME_DAY; }