We want to cache, using Ehcache, sensitive data that should never be stored to disk (data can only reside in main memory). It is the kind of data that is illegal for it to be stored on disk at all and therefore needs to be treated with a certain caution.
We are already using Ehcache (both with and without terracotta) for common caching purposes.
I know that Ehcache provides the option to cache on both to main memory and to disk, and additionally it allows to overflowtodisk when using main memory.
I am new to Ehcache, and would like to know of how to configure Ehcache so as to guarantee that this particular cache never touches the disk. (we are currently mostly using default configuration) Additionally it would be nice to have a way to confirm where data is being stored once we have the implementation running (to confirm that no data is not stored the disk).
At the cache level:
The legacy
overflowToDiskconfiguration setting isfalseby default. The modernpersistenceelement, if absent, defaults tonone. In both these cases, the cache configured will not have a disk tier and so will not write any entries to disk.If the same cache manager hosts disk backed caches, it will be creating files in the configured folder - or
java.io.tmpdir- which will have the cache name in their path. As this name is encoded to be used in path, it may not be easy to match, but you will be able to assess that your cache without a disk backend does not have any files created in this structure.