2 ms·
I was just looking at this last week when I needed to bash a cache together for something. It's an easier problem than SIEVE's use case, because I don't mind se
by jerf 2y ago
I was just looking at this last week when I needed to bash a cache together for something. It's an easier problem than SIEVE's use case, because I don't mind setting a value for "how many things this cache will hold", letting it balloon up to 2x that size, then just purging it back down to the limit when it gets hit. (Which isn't entirely algorithmically dissimilar from SIEVE in some sense, not entirely unlike batching up the entire eviction process rather than running it continuously.) A neat thing about the observations in SIEVE is that you can use the observation that just a single bit "was this used since last time?" flag is very, very simple to implement in almost any cache implementation, way easier than pulling in a tree or something, but gets you a lot of the effectiveness of those algorithms. It's a real time saver when you have to build your own cache and you want something better than FIFO but don't want to implement something complicated and hard-to-test.