ben-manes / caffeine

A high performance caching library for Java
Apache License 2.0
15.64k stars 1.58k forks source link

Can `Caffeine Cache` cache large objects to local disk instead of memory? #1694

Closed herywang closed 3 months ago

herywang commented 3 months ago

Hello guys, we have a scene in which the object is very large, I am not sure the caffeine cache could cache those large objects to the local disk.

When I use Guava Cache or Hutool Cache, I have to control cache capacity when the object is large because it is easy to have an OutOfMemoryException.

I urgently hope there is a cache tool that can achieve the above feature. If Caffeine doesn't have this feature, can I contribute this feature to Caffeine?

ben-manes commented 3 months ago

This is where other libraries make sense, for example MapDB, ehcache, or frameworks like Infinispan. Or you can layer Caffeine above a disk store like RocksDB as a lookaside cache. MySQL has a memcached mode for a persistent remote cache.

It’s out of scope to offer this feature directly.

herywang commented 3 months ago

Okay, I got it. Thank you for your answer.