You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are working on an article about the current state of concurrent cache implementations in Go. We are planning to include freecache with following short description. Please let me know if my understanding is correct, or you would like to modify it.
FreeCache divides the cache into 256 segments. Each segment contains 256 slots
and a ring buffer to store the data. When a new key is added to the cache,
segment id is identified using the lower 8 bit of the hash of the key. Further,
slot is chosen using the LSB 9 to LSB 16 of the hash of the key. Dividing data into
slots helps in reducing the search space while looking for a key in the cache.
The data is then appended into the ring buffer and offset is stored into a sorted array.
If ring buffer doesn't have enough space, eviction is performed in the segment
from the beginning of the ring buffer using a modified LRU policy. An entry is
deleted from the ring buffer if the last access time for the entry is smaller
than the average access time of the segment. To find an entry in a cache on Get,
a binary search is performed in the sorted array in the corresponding slot.
The text was updated successfully, but these errors were encountered:
We are working on an article about the current state of concurrent cache implementations in Go. We are planning to include freecache with following short description. Please let me know if my understanding is correct, or you would like to modify it.
The text was updated successfully, but these errors were encountered: