Skip to content
Commit 351149a6 authored by Anders Martinsson's avatar Anders Martinsson
Browse files

Update DLF cache



Much faster than before, a cache of 100 MiB runs fast. The solution is built
with a map and a deque. The map is used for key based lookup and the deque is
used for keeping order (which keys are accessed the most). The key is stored
twice and the map take up some extra space so there is an increased overhead.

Add and get is logarithmic time. There might be a need to remove a couple of
items before add, if that is the case each removal will be logarithmic.
Resize is either constant (if size is increased) or n * logarithmic where n is
the number of items that need to be removed.

Signed-off-by: default avatarAnders Martinsson <anders.martinsson@intinor.se>
parent e01c8b63
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment