RedisLess
RedisLess copied to clipboard
garbage collection
still WIP
- This PR strives to change the API of
Storage
to be more user-friendly. Specifically,read
+hread
to be read-only (taking&self
instead of&mut self
). This is to clear the ground to compose them with other commands. Specifically,COPY
(#25) needs to call bothread
andwrite
on theStorage
and cannot have multiple mutable references. - there are 2 parts for this PR.
- first, read commands merely marks the values with expired TTL with a "tombstone" in an atomic, immutable way. this relaxes the
&mut self
requirement - second, --- not implemented yet--- a GC worker is spawned. This thread should work the same as original Redis GC algorithm works see here.
Note about the 2nd stage. One could argue that deleting keys in a lazy fashion is not enough as it could lead to memory bloat and rightly so! However, A GC thread is needed anyway since expired keys need to be evicted even if they are not visited.
Hi @barkanido, is it still WIP? Did you manage to make it works?
@evoxmusic this is still WIP. I wanted your comments on this design, and if we all agree, then some help in progressing with the GC implementation itself