public abstract class CommonEhCacheCacheService extends java.lang.Object implements CommonCacheService
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<java.lang.String,net.sf.ehcache.config.CacheConfiguration> |
cacheConfigurations |
protected net.sf.ehcache.CacheManager |
cacheManager |
protected TechnicalLoggerService |
logger |
| Constructor and Description |
|---|
CommonEhCacheCacheService(TechnicalLoggerService logger,
java.util.List<CacheConfiguration> cacheConfigurations,
CacheConfiguration defaultCacheConfiguration,
java.lang.String diskStorePath) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
buildCacheManagerWithDefaultConfiguration() |
boolean |
clear(java.lang.String cacheName)
Clear the cache named by cacheName
|
void |
clearAll()
Clear all cache of the service
|
protected net.sf.ehcache.Cache |
createCache(java.lang.String cacheName,
java.lang.String internalCacheName) |
java.lang.Object |
get(java.lang.String cacheName,
java.lang.Object key)
Get a cached object.
|
protected abstract java.lang.String |
getCacheManagerIdentifier() |
int |
getCacheSize(java.lang.String cacheName)
Return the size of the cache with cacheName.
|
protected net.sf.ehcache.config.CacheConfiguration |
getEhCacheConfiguration(CacheConfiguration cacheConfig) |
protected abstract java.lang.String |
getKeyFromCacheName(java.lang.String cacheName) |
java.util.List<java.lang.Object> |
getKeys(java.lang.String cacheName)
Get list of keys on a cache.
|
boolean |
isStopped() |
boolean |
remove(java.lang.String cacheName,
java.lang.Object key)
Remove the element according to the cache name and the key
|
protected void |
shutdownCacheManager() |
void |
store(java.lang.String cacheName,
java.io.Serializable key,
java.lang.Object value)
Store an object in the cache.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetCachesNamesprotected net.sf.ehcache.CacheManager cacheManager
protected final TechnicalLoggerService logger
protected final java.util.Map<java.lang.String,net.sf.ehcache.config.CacheConfiguration> cacheConfigurations
public CommonEhCacheCacheService(TechnicalLoggerService logger, java.util.List<CacheConfiguration> cacheConfigurations, CacheConfiguration defaultCacheConfiguration, java.lang.String diskStorePath)
protected net.sf.ehcache.config.CacheConfiguration getEhCacheConfiguration(CacheConfiguration cacheConfig)
protected void buildCacheManagerWithDefaultConfiguration()
throws SCacheException
SCacheExceptionprotected abstract java.lang.String getCacheManagerIdentifier()
protected net.sf.ehcache.Cache createCache(java.lang.String cacheName,
java.lang.String internalCacheName)
throws SCacheException
SCacheExceptionpublic void store(java.lang.String cacheName,
java.io.Serializable key,
java.lang.Object value)
throws SCacheException
CommonCacheServicestore in interface CommonCacheServicecacheName - The name of the cache in which the object must be storedkey - The key that will allow to retrieve the objectvalue - The object to storeSCacheException - Error thrown if has exceptions during the cache store.protected abstract java.lang.String getKeyFromCacheName(java.lang.String cacheName)
throws SCacheException
SCacheExceptionpublic java.lang.Object get(java.lang.String cacheName,
java.lang.Object key)
throws SCacheException
CommonCacheServiceget in interface CommonCacheServicecacheName - The name of the cache on which to get the objectkey - The key that is used to store the objectSCacheException - Error thrown if has exceptions during the cache object get.public boolean clear(java.lang.String cacheName)
throws SCacheException
CommonCacheServiceclear in interface CommonCacheServicecacheName - The name of the cache to clearSCacheException - Error thrown if has exceptions during the cache clear.public int getCacheSize(java.lang.String cacheName)
throws SCacheException
CommonCacheServicegetCacheSize in interface CommonCacheServicecacheName - The name of cacheSCacheException - if no cache is found with that name.public void clearAll()
throws SCacheException
CommonCacheServiceclearAll in interface CommonCacheServiceSCacheException - Error thrown if has exceptions during the cache clear.public boolean remove(java.lang.String cacheName,
java.lang.Object key)
throws SCacheException
CommonCacheServiceremove in interface CommonCacheServicekey - The name of the cache where the object must be stored
The key that will allow to retrieve the objectSCacheException - Error thrown if has exceptions during the cache remove.public java.util.List<java.lang.Object> getKeys(java.lang.String cacheName)
throws SCacheException
CommonCacheServicegetKeys in interface CommonCacheServicecacheName - The name of the cache on which to get the key listSCacheExceptionprotected void shutdownCacheManager()
public boolean isStopped()
isStopped in interface CommonCacheService