EhcacheModule

EhcacheModule provides support for Ehcache in other modules. It creates an Ehcache cache manager and hooks it up to the Spring CacheManager infrastructure. The module also provides debug web controllers for viewing cache statistics and flushing the caches.

Cache manager

EhcacheModule requires a valid ehcache configuration to be specified, either via an xml resource (ehcacheModule.configurationResource property) or a net.sf.ehcache.config.Configuration instance (ehcacheModule.configurationObject property). Upon bootstrapping the cache manager will be created and available as a Spring CacheManager implementation.

EhcacheModule will also activate support for the cache related annotations in every module. This would be the equivalent of putting @EnableCaching in every module.

Modules should avoid wiring Ehcache beans directly but use the Spring cache abstraction layer.

Debug web controllers

Only available if DebugWebModule is present.

When active, EhcacheModule adds a section Cache overview to the debug menu. The debug web controller supports multiple Ehcache cache managers and offers the following functions for each cache manager:

  • see cache statistics

  • browse individual cache items

  • flush caches either individually or per cache manager

  • calculate cache heap size

  • view remote RMI peers if RMI-based cache distribution is enabled

Calculating cache heap size

Apart from the actual heap size the debug controllers attempt to predict the maximum heap size using linear interpolation. All heap size values should be considered an estimation as they cannot always be calculated correctly.