I have a method that returns the (rarely-changed) configuration of a system and want to cache it. The configuration is built from different pieces of data so I don't want to cache the individual pieces, but the SystemConfiguration
object itself.
There is no argument to the method, how can I tell Ehcache to use a fixed key "configuration" (there's only one instance of the configuration)? Do I have to create a CacheKeyGenerator
or is there a simpler method?
@CacheResult //how to specify the fixed key?
public SystemConfiguration getConfiguration() {
return configuration; //this is a prebuilt object, as described
}