Redis, how to search by value in a sorted set?

287 Views Asked by At

I have a sorted list like the below: "id" "{"date":1664353365563}"

So I need to delete from the sorted list when date is lass than today.

How to do such scenario?

I tried zrem but it didn't work.

1

There are 1 best solutions below

5
Guy Royse On

You can ZREMRANGEBYSCORE. The command would be:

redis> ZREMRANGEBYSCORE id 0 1664353365563

Replace 1664353365563 with the timestamp for yesterday.