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
I'm working on a crate called typesize, generating estimates of struct sizes. I want to write an implementation for mini-moka however the interface is quite opaque, and I can handle under-shooting by generating from the iterator, but I'm also missing the capacity which seems like a pretty simple request.
If the capacity could be exposed for both caches, that would be lovely.
The text was updated successfully, but these errors were encountered:
Hi. Thank you for the request. However, I am afraid that exposing HashMap/DashMap’s capacity is not enough to calculate the amount of memory that a Cache uses.
A mini-moka Cache consists of several data structures and the followings greatly contribute the memory usage.
A hash table (HashMap or DashMap) to store cached entries.
A doubly linked list to track recent accesses to cached entries.
If TTL (time to live) is configured, another doubly linked list is enabled to track the write order of cached entries.
A frequency sketch (LFU filter), which estimates popularities of every keys that has been accessed (no matter if cached or not).
Two mpmc channels to buffer recordings of read and write operations to cache.
Also, each cached entry has metadata attached to track their state. They contribute the memory usage too.
See the following moka (not mini-moka) issue for more info:
There is a plan to provide statistics information about a Cache, and we could use it to provide the memory sizes of these data structures. I am currently hospitalized, but when I get better, I will think further about this.
I'm working on a crate called typesize, generating estimates of struct sizes. I want to write an implementation for
mini-moka
however the interface is quite opaque, and I can handle under-shooting by generating from the iterator, but I'm also missing the capacity which seems like a pretty simple request.If the capacity could be exposed for both caches, that would be lovely.
The text was updated successfully, but these errors were encountered: