Issue
I'm using RedisTemplate(from Spring) in my Java app. I need to do pop from a list of elements correspondenting for values, but without removing it. Any suggestions?
Solution
You can easily peek at an item rather than popping it by using the range command.
With Spring, from a RedisTemplate instance, you can get a ListOperations instance by using the opsForList() method, and then:
listOp.range(key, 0, 0) will return the first (left) item without popping it
listOp.range(key, -1, -1) will return the last (right) item without popping it
See documentation at:
Answered By - Didier Spezia
Answer Checked By - Cary Denson (JavaFixing Admin)