How to set a limit on the amount of heap and disk space used by Stale Page Cache?


Documentation only mentions parameters limiting the number of items stored in the cache (maxEntriesLocalHeap, maxEntriesLocalDisk).

Ehcache, which I understand is what Stale Page Cache is build on, also supports settings maxBytesLocalHeap and maxBytesLocalDisk.

Is it possible to use the latter two settings (or similar) with Stale Page Cache?


These settings don’t seem to be supported out-of-the-box.

Maybe you can try to override the following Spring bean in your project, extend/reconfigure HippoEhCacheFactoryBean and add your settings:

  <bean id="com.onehippo.cms.spring.cache.ehcache.stalePageCache" class="com.onehippo.cms.spring.cache.ehcache.HippoEhCacheFactoryBean">
    <property name="cacheName" value="stalePageCache"/>

(snippet taken from hippo-addon-caching.jar)

1 Like

Thanks a lot, @jeroen.hoffman :+1:

For those contemplating doing it this way, this page describes how to override Spring Beans with custom definitions.