BigMemory 4.3.7 | Product Documentation | BigMemory Max Configuration Guide | Configuring BigMemory Max | Dynamically Changing Cache Configuration
 
Dynamically Changing Cache Configuration
While most of the BigMemory Max configuration is not changeable after startup, certain cache configuration parameters can be modified dynamically at runtime. These include the following:
*Expiration settings
*timeToLive – The maximum number of seconds an element can exist in the cache regardless of access. The element expires at this limit and will no longer be returned from the cache. The default value is 0, which means no TTL eviction takes place (infinite lifetime).
*timeToIdle – The maximum number of seconds an element can exist in the cache without being accessed. The element expires at this limit and will no longer be returned from the cache. The default value is 0, which means no TTI eviction takes place (infinite lifetime).
Note that the eternal attribute, when set to "true", overrides timeToLive and timeToIdle so that no expiration can take place.
*Local sizing attributes
*maxEntriesLocalHeap
*maxBytesLocalHeap
*maxEntriesLocalDisk
*maxBytesLocalDisk.
*memory-store eviction policy.
*CacheEventListeners can be added and removed dynamically
This example shows how to dynamically modify the cache configuration of a running cache:
Cache cache = manager.getCache("sampleCache");
CacheConfiguration config = cache.getCacheConfiguration();
config.setTimeToIdleSeconds(60);
config.setTimeToLiveSeconds(120);
config.setmaxEntriesLocalHeap(10000);
config.setmaxEntriesLocalDisk(1000000);
Dynamic cache configurations can also be disabled to prevent future changes:
Cache cache = manager.getCache("sampleCache");
cache.disableDynamicFeatures();
In ehcache.xml, you can disable dynamic configuration by setting the <ehcache> element's dynamicConfig attribute to "false".