REDIS. Get where clause

1.3k Views Asked by At

I have this keys list:

 redis 127.0.0.1:6379> keys *
  1) "r:fd:g1:1377550557255"
  2) "r:fd:g1:1377550561240"
  3) "r:fd:g1:1377550561561"
  4) "r:fd:g1:1377550562300"
  5) "r:fd:g1:1377550558977"
  6) "r:fd:g1:1377550561344"
  7) "r:fd:g1:1377550561832"
  8) "r:fd:g1:1377550560344"
  9) "r:fd:g1:1377550559978"
 10) "r:fd:g1:1377550557777"
 11) "r:fd:g1:1377550554258"
 12) "r:fd:g1:1377550556772"
 13) "r:fd:g1:1377550559649"
 14) "r:fd:g1:1377550555460"
 15) "r:fd:g1:1377550560895"
 16) "r:fd:g1:1377550559139"
 17) "r:fd:g1:1377550556595"
 18) "r:fd:g1:1377550557634"

How i can get only this keys where timestamp is more then 1377550561300 ?

1

There are 1 best solutions below

1
On

You can't do this.
But you can use sorted sets and write timestamps as scores, then you'll be able to use zrangebyscore:

zrangebyscore key 1377550561300) +inf