Answer the question
In order to leave comments, you need to log in
How to make a sorted selection by TTL?
Good day!
There is a lot of short-lived data, say, about 10,000 records, with a limit of 10 minutes.
They need to be sorted by TTL and the selection should be limited. I thought to use Redis for this purpose, but after cursory attempts, it hung.
Is it really possible to implement using Redis or is it worth using some other options?
Answer the question
In order to leave comments, you need to log in
I think you should use Sorted sets
Here is an eloquent example from the documentation:
> zadd hackers 1940 "Alan Kay"
(integer) 1
> zadd hackers 1957 "Sophie Wilson"
(integer 1)
> zadd hackers 1953 "Richard Stallman"
(integer) 1
> zadd hackers 1949 "Anita Borg"
(integer) 1
> zadd hackers 1965 "Yukihiro Matsumoto"
(integer) 1
> zadd hackers 1914 "Hedy Lamarr"
(integer) 1
> zadd hackers 1916 "Claude Shannon"
(integer) 1
> zadd hackers 1969 "Linus Torvalds"
(integer) 1
> zadd hackers 1912 "Alan Turing"
(integer) 1
> zrevrange hackers 0 -1
1) "Linus Torvalds"
2) "Yukihiro Matsumoto"
3) "Sophie Wilson"
4) "Richard Stallman"
5) "Anita Borg"
6) "Alan Kay"
7) "Claude Shannon"
8) "Hedy Lamarr"
9) "Alan Turing"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question