Implemented eviction algorithm that samples a configurable number of keys with TTLs (default 20) at a configurable interval (default 100ms) and deletes the keys that are expired.

This commit is contained in:
Kelvin Mwinuka
2024-03-12 02:12:55 +08:00
parent 52b39d5b0f
commit f27a0dda79
6 changed files with 121 additions and 17 deletions

View File

@@ -121,10 +121,6 @@ func (r *Raft) RaftInit(ctx context.Context) {
}
r.raft = raftServer
// TODO
// Listen on leadership change channel and initiate key eviction goroutine
// if current node is the leader.
}
func (r *Raft) Apply(cmd []byte, timeout time.Duration) raft.ApplyFuture {