Closed iamwuyunfeng closed 1 year ago
Tidis
does not support active key expiration yet. But we can trigger the keys expiration using scan
command to scan all keyspace.
This feature can be added later.
Tidis
does not support active key expiration yet. But we can trigger the keys expiration usingscan
command to scan all keyspace.This feature can be added later.
I see, thanks. @yongman
I am trying to understand how Tidis implements redis protocol. I known that an
get
command for a string will check its ttl and delete it if expired, but what if a key has outlived its ttl and is never accessed after it's set ? In other Redis alike products, like Tendis, will use rocksdb's compaction filter to delete those keys in compaction, or launch a background thread to periodically scan those expired keys and delete them. I do notice that the Db set() method would use a BTreeMap to track keys with ttl, but I don't see there is any releationship between the Db set method and the ttl releated commands such asexpire
orsetex
, it seems that the latter would directly write kv into TiKV without using any TiKV's ttl interface ? Besides, the set() method of Db is marked as dead_code and is written in 3 years ago, I assume that is the legacy code from Tidis 1.0 ? So is the lazy expiration the only way to delete expired keys in Tidis or am I missing anything ?