public abstract class CdmCacher extends java.lang.Object implements ICdmUuidCacher
Modifier and Type | Field and Description |
---|---|
net.sf.ehcache.CacheManager |
cacheManager |
static java.lang.String |
DEFAULT_CACHE_NAME |
static Logger |
logger |
Constructor and Description |
---|
CdmCacher()
Constructor which initialises a singleton
CacheManager |
Modifier and Type | Method and Description |
---|---|
void |
addCacheManager(net.sf.ehcache.CacheManager cacheManager)
Returns the singleton default cache manager.
|
void |
dispose() |
boolean |
exists(CdmBase cdmBase) |
boolean |
exists(java.util.UUID uuid)
Check if a CDM Entity with given UUID exists in the cache.
|
boolean |
existsAndIsNotNull(java.util.UUID uuid)
Check if a CDM Entity with given UUID exists in the cache
and that it is not null.
|
protected abstract CdmBase |
findByUuid(java.util.UUID uuid)
Finds CDM Entity by uuid
|
net.sf.ehcache.Element |
getCacheElement(java.util.UUID uuid)
Gets the cache element corresponding to the given
UUID |
net.sf.ehcache.Cache |
getDefaultCache()
Returns the default cache
|
protected net.sf.ehcache.config.CacheConfiguration |
getDefaultCacheConfiguration()
Returns the default cache configuration.
|
<T extends CdmBase> |
getFromCache(T cdmBase)
Retrieves the cached version of the passed entity from the cache if it
exists in there.
|
CdmBase |
getFromCache(java.util.UUID uuid)
Get a CDM Entity object with given UUID from the (default) cache.
|
abstract <T extends CdmBase> |
load(T cdmEntity)
Load into the cache and return the entity from the cache.
|
CdmBase |
load(java.util.UUID uuid)
Load a CDM Entity object with given UUID.
|
void |
put(CdmBase cdmEntity)
Puts the passed
cdmEntity into the cache as long it does not
yet exist in the cache. |
void |
put(java.util.UUID uuid,
CdmBase cdmEntity)
Puts the (Key,Value) pair of (
UUID , CdmBase ),
in the cache |
protected abstract void |
setup() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isCachable
public static final Logger logger
@Autowired public net.sf.ehcache.CacheManager cacheManager
public static final java.lang.String DEFAULT_CACHE_NAME
public CdmCacher()
CacheManager
protected abstract void setup()
public void addCacheManager(net.sf.ehcache.CacheManager cacheManager)
conf
- protected net.sf.ehcache.config.CacheConfiguration getDefaultCacheConfiguration()
public net.sf.ehcache.Cache getDefaultCache()
public void dispose()
dispose
in interface ICdmCacher
public net.sf.ehcache.Element getCacheElement(java.util.UUID uuid)
UUID
uuid
- public void put(java.util.UUID uuid, CdmBase cdmEntity)
ICdmUuidCacher
UUID
, CdmBase
),
in the cacheput
in interface ICdmUuidCacher
public CdmBase load(java.util.UUID uuid)
ICdmUuidCacher
load
in interface ICdmUuidCacher
uuid
- of CDM Entity to returnpublic CdmBase getFromCache(java.util.UUID uuid)
ICdmUuidCacher
getFromCache
in interface ICdmUuidCacher
public <T extends CdmBase> T getFromCache(T cdmBase)
ICdmCacher
getFromCache
in interface ICdmCacher
cdmBase
- the cdm entity to find in the cachenull
public void put(CdmBase cdmEntity)
ICdmCacher
cdmEntity
into the cache as long it does not
yet exist in the cache.put
in interface ICdmCacher
public abstract <T extends CdmBase> T load(T cdmEntity)
ICdmCacher
cdmEntity
passed to this method.load
in interface ICdmCacher
public boolean exists(java.util.UUID uuid)
ICdmUuidCacher
exists
in interface ICdmUuidCacher
uuid
- of CDM Entity to checkpublic boolean exists(CdmBase cdmBase)
exists
in interface ICdmCacher
cdmEntity
is found in the cachepublic boolean existsAndIsNotNull(java.util.UUID uuid)
ICdmUuidCacher
existsAndIsNotNull
in interface ICdmUuidCacher
uuid
- of CDM Entity to checkprotected abstract CdmBase findByUuid(java.util.UUID uuid)
Copyright © 2007-2020 EDIT. All Rights Reserved.