commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Vandahl>
Subject Re: [jcs] Migrating from Ehcache to JCS, need help getting the right config
Date Wed, 22 Mar 2017 17:44:20 GMT
Hi there,

On 21.03.17 15:50, robertlazarski . wrote:
> Hello! We have a production system running Ehcache and we'd like to
> use JCS instead. What I need to do with JCS is:
> 1) Load all Objects into memory, unlimited with infinite "time to
> live". In practice over many years, its not been a problem for us.
> Currently using LRU.

Yes, this is easy, just define a memory cache big enough to hold all
your objects. Set


> 2) Store Objects from memory to disk on JVM shutdown, or at least
> periodically flush to disk - while keeping the entire cache in memory.

for the configuration of an auxiliary disk cache. If you have configured
your memory cache big enough, no "overflow" of items to disk will happen
in normal operation.

You need to shut down the cache orderly
(CompositeCacheManager.getInstance().shutDown()) to trigger the "dump to
disk" process. There is no simple method to do this periodically.

> 3) Most importantly, on server startup we need the entire disk
> persisted cache loaded into memory, i.e. "cache warming" . I am
> wondering if the CacheLoaderAdapter is the right class for this?
> Currently we use a class that Ehcache calls on startup that just uses
> an Iterator over all the cache Elements, effectively loading
> everything into memory.

This can be achieved by setting ClearDiskOnStartup=false. This happens
to be the default. JCS will load all the keys into memory then but not
the values. So if you want the values to be loaded, just modify the
class you used for EHCache.

How to integrate this into your application depends on your application
lifecycle. There is no CacheLoaderAdapter class in JCS. If you tell me a
bit more about your application, I might be able to give you a hint.

Bye, Thomas

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message