I'm with a scaffman. In addition to overflowing to disk, EhCache offers you to put the cache in the process, but not in a heap. If your cache is really large, this can have a very positive effect on performance, as it reduces the load on the GC.
This particular function, however, must be paid for, but otherwise EhCache is free.
Instead of Java EhCache, there are several other caches that offer similar or sometimes even more advanced options, such as Infinispan or OsCache.
source share