I am trying to delete keys by pattern from redis server with nutcracker as proxy but it shows error while executing jedis.keys which I am using in my java code. It doesn't allow keys and scan method that I know. I am using simple set method to make a key-value entry in the redis. So can anyone suggest any alternative method to fetch keys by pattern from redis?
Stacktrace of the exception:
redis.clients.jedis.exceptions.JedisConnectionException: Unexpected end of stream.
at redis.clients.util.RedisInputStream.ensureFill(RedisInputStream.java:199)
at redis.clients.util.RedisInputStream.readByte(RedisInputStream.java:40)
at redis.clients.jedis.Protocol.process(Protocol.java:153)
at redis.clients.jedis.Protocol.read(Protocol.java:218)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:341)
at redis.clients.jedis.Connection.getBinaryMultiBulkReply(Connection.java:277)
at redis.clients.jedis.Jedis.keys(Jedis.java:284)
Server timeout value is set to be 0 and jedis version which I have been using is 2.10.2. Following is the code snippet which I am trying to execute:
try {
Set<String> keys = jedis.keys(pattern);
jedis.del(keys.toArray(new String[keys.size()]));
} catch(Exception e) {
log.error("Failed to delete key entry for pattern {0}", pattern);
throw e;
}