Skip to content

What's the recommended way to persist the cache between application runs? #828

Answered by ben-manes
sschuberth asked this question in Q&A
Discussion options

You must be logged in to vote

I believe usually what is needed to implement this is ordered access, e.g. to capture the X% hottest entries. If you want to capture everything without order then the asMap() view is ideal, but for a fast restart that might be too much data. The cache.policy() apis expose methods like <T> T hottest(Function<Stream<CacheEntry<K, V>>, T> mappingFunction), with convenience versions for count or weight. These require locking so the functions should be fast snapshots with the serialization performed afterwards.

Java serialization is supported but only captures the configuration and not the data. That is to be usable in distributed compute logic, e.g. Spark functions, where the data should be m…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@sschuberth
Comment options

@ben-manes
Comment options

@sschuberth
Comment options

Answer selected by ben-manes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants