OpenKM uses several caches to enhance performance. Some of these caches are directly used by OpenKM and others indirectly, for example those used by Hibernate. All these caches have default values which make them useful but these default values are not always good for every installation. The cache engine used is the very popular EHCache, which is widely used and very configurable. You can see the default values at $TOMCAT_HOME/webapps/OpenKM/WEB-INF/classes/ehcache.xml.
Don't modify this file because all changes will be lost when OpenKM is restarted or updated.
If you want to tweak this default configuration you have to duplicate the provided configuration file into $TOMCAT_HOME/ehcache.xml and make the proper changes to match your requirements. This is a sample definition:
<cache name="com.openkm.cache.ldapPrincipalAdapter.general" maxElementsInMemory="1000" timeToIdleSeconds="300" timeToLiveSeconds="0" overflowToDisk="true" eternal="false" />
The most important values are:
- timeToLive: The maximum number of seconds an element can exist in the cache regardless of use. 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).
Be careful with eternal, because it sets whether elements are eternal. In case of true, timeouts are ignored and the element never expires.
So, in this case the cache called "com.openkm.cache.ldapPrincipalAdapter.general" will have a maximum of 1000 elements in memory and in case of overflow will be written to disk. These elements will be removed from this cache if are unused for 5 minutes. Otherwise, will remain forever. If you want to force a refresh, you have to change the timeToLiveSeconds to 3600 and will be refreshed every hour.
You can check these caches status by going to Administration > Utilities > Cache stats. In this part you can enable and see the cache usage stats and even reset a give one. More info at Cache stats.