@Override public String get(@NotNull String key) { if (key == null) { throw new IllegalArgumentException("Cannot get null key"); } String rKey = redisKey(storeName, key); try (Jedis jedis = pool.getResource()) { return jedis.get(rKey); } catch (JedisException e) { redisIsHealthy = false; String msg = String.format("Unable to get key %s (Redis key %s)", key, rKey); LOG.error(msg); throw new RuntimeException(e); } }
@Override public String remove(@NotNull String key) { if (key == null) { throw new IllegalArgumentException("Cannot remove null key"); } String rKey = redisKey(storeName, key); try (Jedis jedis = pool.getResource()) { String previousValue = jedis.get(rKey); jedis.del(rKey); return previousValue; } catch (JedisException e) { redisIsHealthy = false; String msg = String.format("Unable to remove key %s (Redis key %s)", key, rKey); LOG.error(msg); throw new RuntimeException(msg, e); } }
String rKey = redisKey(storeName, key);
escapedStoreName = escapedStoreName.replace("]", "\\]"); // escape ']' escapedStoreName = escapedStoreName.replace("?", "\\?"); // escape '?' String pattern = redisKey(escapedStoreName, "*"); // e.g., bard-escaped_dimension-*