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
Post a Comment