Copyright © 2014-2015
Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.
About
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.
Module website: https://foreach.atlassian.net/wiki/display/AX/EhcacheModule
1. General information
1.1. Artifact
<dependencies>
<dependency>
<groupId>com.foreach.across.modules</groupId>
<artifactId>ehcache-module</artifactId>
<version>1.0.0.RELEASE</version>
</dependency>
</dependencies>
1.2. Module dependencies
Module | Type | Description |
---|---|---|
optional |
Enables the debug controllers. |
1.3. Module settings
Property | Type | Description | Default |
---|---|---|---|
ehcache.configuration.resource |
|
Ehcache XML resource file. |
classpath:ehcache.xml |
ehcache.configuration |
|
Configuration class instance or class name. |
null |
ehcache.cacheManager.name |
|
Name of the CacheManager instance. |
null |
ehcache.cacheManager.shared |
|
Should the created CacheManager be shared at the ClassLoader level. |
true |
2. What’s new in this version?
1.0.0.RELEASE
Initial public release available on Maven central.
3. Cache manager
EhcacheModule requires a valid ehcache configuration to be specified, either via an xml resource (ehcache.configuration.resource property) or
a net.sf.ehcache.config.Configuration
instance (ehcache.configuration 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.
Tip
|
Modules should avoid wiring Ehcache beans directly but use the Spring cache abstraction layer. |
4. Debug web controllers
Note
|
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
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.