Product Documentation : Ehcache Developer Guide : Cache Exception Handlers : Programmatic Configuration
Programmatic Configuration
The following example shows how to add exception handling to a cache, and then add the cache back into cache manager so that all clients obtain the cache handling decoration.
CacheManager cacheManager = ...
Ehcache cache = cacheManger.getCache("exampleCache");
ExceptionHandler handler = new ExampleExceptionHandler(...);
Ehcache proxiedCache = ExceptionHandlingDynamicCacheProxy.createProxy(cache);
cacheManager.replaceCacheWithDecoratedCache(cache, proxiedCache);
Copyright © 2010-2015 Software AG, Darmstadt, Germany.

Product Logo |   Feedback