I am new to Guava Cache. How do I create the following in the cache?
- Save the data in memory as normal.
- When the size of the cache is over the given number, it will persist the data in cache in a configurable file on the hard disk.
I am new to Guava Cache. How do I create the following in the cache?
This will probably be helpful: Extending Guava caches to overflow to disk
The API (and the feature set) is a bit heavy weight but I've used Ehcache in the past and it worked well. Similar technologies include Infinispan and Hazelcast.
I don't like the solution in the article Chris shared as performance and the storage limit will depend on the file system you run on (and won't be particularly good), and it also lacks protection against corruption etc. If you plan to use it in production, I'd use one of these libraries.