Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default expiration of Google Guava Caching

Tags:

java

guava

I would like to know the default expiration policy of Guava caching. My need is , write once and read many times. The cache should never expire. Is this the default behavior of Guava ?

like image 870
srinannapa Avatar asked Sep 23 '14 19:09

srinannapa


People also ask

Is Guava cache persistent?

README.md. A Guava cache extension that allows caches to persist cache entries when they cannot longer be stored in memory. An implementation that overflows to the file system is provided including a corresponding CacheBuilder with similar semantics than the Guava CacheBuilder .

What is Google Guava cache?

The Guava Cache is an incremental cache, in the sense that when you request an object from the cache, it checks to see if it already has the corresponding value for the supplied key. If it does, it simply returns it (assuming it hasn't expired).

What is concurrency level in Guava cache?

Guava's cache is built on top of Java 5's ConcurrentHashMap with a default concurrency level of 4. This setting is because that hash table is segmented into multiple smaller tables, so more segments allows for higher concurrency at a cost of a larger memory footprint.


1 Answers

Assuming you are talking about CacheBuilder

From the Google docs

By default cache instances created by CacheBuilder will not perform any type of eviction.

like image 155
Sourav 'Abhi' Mitra Avatar answered Oct 19 '22 10:10

Sourav 'Abhi' Mitra