Hello, indeed the expire times are user defined and we need to insert
in-the-middle. So actually the radix tree tends to perform quite well
in that case, not sure we can get a big boost from using a different
data structure, especially because ordering *just* for expire time is
not enough, we need to also store the key name in some form. However
what it is possible to do that I didn't try in order to make the Radix
tree more efficient in that case, is to use a radix tree to just index
the expire times, and every single expire time than has a linked list
structure with the keys that will expire in that exact time. But there
are tradeoffs here as well because we need to remove the keys when an
expire is redefined or removed at all, so the key object would need to
hold the pointer to the linked list node. In general I've the feeling
that the radix tree that we are using now is quite optimized already
for time and space (is faster than the hash table we use for many
workloads, for instance), and is more a problem if understanding if
this is the right design, or is better to use the tree just to augment
the old design with more information. I'm going to attempt writing a
branch with such "augmenting" idea in order to compare the two...
On Thu, Jun 20, 2019 at 6:08 PM Bogdan Storozhuk
<
storoz...@gmail.com> wrote:
>
> But of course, such algorithm won't work in case of user user-specified expiration times. :-(
>
> To view this discussion on the web visit
https://groups.google.com/d/msgid/redis-db/30919cd6-f5fd-465b-ac49-a49e3508be25%40googlegroups.com.