-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Question] Configuring a cache with pinned objects only #264
Comments
If no objects are to be evicted, maybe you can use an unbounded cache? That is optimized for as a lightweight wrapper on top of Alternatively, if you are fetching it up front you might prefer to use Guava's |
thx @ben-manes I would like to use a Caffeine cache as I could change the configuration easily if I later find out I could not cache everything and need to implement an eviction strategy after all. What is a unbounded cache and how could I create that? Does it differ? |
An unbounded cache is merely |
ah, I'm using unbound caches than already :-) |
yeah, just don't use a custom weigher as no pinning is needed. Pining is if you use eviction but some items have to be excluded temporarily because there is a client-side lock. Kind of an edge case for some infrastructure projects (like databases) and natively supported by coincidence, so explained in the FAQ. For yours, just don't enable the features and you should be set. |
oke thx, I will remove the custom |
What is the best way to create a cache and pre-load it with pinned objects. No object should be evicted and no new objects will be added. More of a static cache offering useful cache stats.
Would a cache with the following characteristics do the job:
set maximum size toconfigure no maximum size0
Weigher
returning simply0
. Would be an idea to add aPinnedWeigher
to the lib?I think this should do the trick, or are there any caveats I should think of?
The text was updated successfully, but these errors were encountered: