Reputation: 163
I'd like to use Guava's Caching functionality, but from what I can tell, you can only evict entries based off of total size of the cache (number of entries) or a timed eviction (for the entire cache). I'd like to have some entries have different expiration times - so I can evict some entries after, say, 1 minute, and other entries after 10 minutes.
Is there some way to specify a field, or a function or something on a cache entry which will have it be evicted if its individual expiration has been passed?
Upvotes: 3
Views: 971
Reputation: 198014
No, there is not. This is so that expiration can be FIFO, rather than requiring an all-up priority queue.
https://code.google.com/p/guava-libraries/issues/detail?id=1203 has the discussion on this topic.
Upvotes: 2