Try to search your question here, if you can't find : Ask Any Question Now ?

Designing a Guava LoadingCache with variable entry expiry

HomeCategory: stackoverflowDesigning a Guava LoadingCache with variable entry expiry
rupesh asked 2 weeks ago

I am using Guava’s LoadingCache into my project to handle thread-{safe,friendly} cache loading and it works wonderfully well. However, there is a limitation.

The current code defining the cache looks like this:

cache = CacheBuilder.newBuilder().maximumSize(100L).build(new CacheLoader<K, V>()
    // load() method implemented here

I don’t specify an expiry time.

The problem is that according to the values of the key, some associated values may expire and others may not. And CacheLoader does not account for this, if you specify an expiry time, it is for each and every entry.

How would you tackle this problem?

1 Answers
Best Answer
Fernando answered 2 weeks ago
Your Answer

3 + 13 =

Popular Tags

WP Facebook Auto Publish Powered By :