topcoderinc / TC-redis-manager

5 stars 15 forks source link

LRANGE List -1 2 is not working #427

Open codejamtc opened 5 years ago

codejamtc commented 5 years ago

image

  1. Deploy the App and run the application (Magenta Theme)
  2. Create a List with data https://github.com/topcoderinc/TC-redis-manager/files/2755278/db-1547472272101.zip
  3. Expand the CLI
  4. Enter LRANGE List -1 2

https://redis.io/commands/lrange

Actual: LRANGE List -1 2 is not working

Expected: Should return correct data

Browser(s): Chrome 71.0.3578.98 (Windows)

sumitdaga commented 5 years ago

the command does work it should be LRANGE List 1 2 and not LRANGE List -1 2 just that it displayed in one single row which i will fix
refer http://take.ms/FoGLq

standlove commented 5 years ago

negative index works for LRANGE as well according to: https://redis.io/commands/lrange

sumitdaga commented 5 years ago

oh yes right ...i will look into it!

sumitdaga commented 5 years ago

ok so yes the condition is that start should be greater than stop otherwise it returns null ...so if you see the documentation -1 is the last element and 2 is the 3rd element and so stop is lesser than start ...so it won't return anything
for ex LRANGE List -2 60 will work and return 2 elements the penumltimate and the last element