Package de.julielab.java.utilities.cache

The cache package organizes the usage of local or remote (socket-connected) caches based on the MapDB library (http://www.mapdb.org/).

Local and remote caches use the very same file cache layout in the end so that the cache files are compatible. The only difference between local and remote caching is that for the local cache only one JVM can write into the cache files. Otherwise, data corruption could happen due to unsynchronized concurrent data modification.

Local Caches

To alleviate this situation - without resorting to a remote cache - caching can be configured to be read-only the configuration object. It is important to note that the first JVM to access to a caching directory will still be granted writing rights if the directory did not already exist. Subsequent access will be read only, if set so in the configuration.

This mechanism can prove quite useful if multiple experiments use the same data. Then, the first experiment will fill the caches and subsequently running experiment will use the cached data.

Remote Caches

If the local caching is not appropriate, for example due to very different data needs of the running experiments, it is relatively straight forward to set up a remote cache. Just use the main method of CacheServer to start up a simple server and configure cacheType=REMOTE in the configuration class together with the remoteCacheHost and remoteCachePort properties pointing to the cache server. This will automatically cause classes using caching to use the RemoteCacheAccess class internally. No other changes are required since the object to be cached must be Serializable in both, file or remote caching.