Not able Scan using redis template -


i trying use scan http://redis.io/commands/scan iterate on keys present in redis. redis template provided spring not have scan() method. there trick use above?

thanks

you can use rediscallback on redisoperations so.

redistemplate.execute(new rediscallback<iterable<byte[]>>() {    @override   public iterable<byte[]> doinredis(redisconnection connection) throws dataaccessexception {      list<byte[]> binarykeys = new arraylist<byte[]>();      cursor<byte[]> cursor = connection.scan(scanoptions.none);     while (cursor.hasnext()) {       binarykeys.add(cursor.next());     }      try {       cursor.close();     } catch (ioexception e) {       // meaningful     }      return binarykeys;   } }); 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -