Package de.hybris.platform.cache2
Class AbstractObjectCacheManager<T>
- java.lang.Object
-
- de.hybris.platform.cache2.AbstractObjectCacheManager<T>
-
- All Implemented Interfaces:
ObjectCacheManager<T>
- Direct Known Subclasses:
Cache2Test.TestObjectCacheManager,ObjectCacheManagerImpl
public abstract class AbstractObjectCacheManager<T> extends java.lang.Object implements ObjectCacheManager<T>
-
-
Constructor Summary
Constructors Constructor Description AbstractObjectCacheManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tfetch(ObjectKey<T> objectKey)Looks for the object under the givenObjectKey.ObjectCache<T>getCache()Returns the underlaying cache.protected java.lang.StringgetDebugKey(ObjectKey<T> objectKey)protected ThandleCreation(ObjectKey<T> objectKey)Default implementation of how objects should be created.protected voidhandleExpiration(ObjectKey<T> objectKey)Default implementation simply removes the expired object.protected voidhandleInvalidation(ObjectKey<T> objectKey)Default implementation simply removed the invalidated object.protected ThandleRequest(ObjectKey<T> objectKey)Default implementation simply requests the cache with the given key.voidinvalidate(ObjectKey<T> objectKey)Invalidates the object under the given (@link ObjectKey}voidsetCache(ObjectCache<T> objectCache)Set the underlaying cache implementationvoidsetExpirationCheck(boolean expirationCheck)voidsetObjectAutoCreation(boolean autocreate)
-
-
-
Method Detail
-
setObjectAutoCreation
public void setObjectAutoCreation(boolean autocreate)
-
setExpirationCheck
public void setExpirationCheck(boolean expirationCheck)
-
getCache
public ObjectCache<T> getCache()
Description copied from interface:ObjectCacheManagerReturns the underlaying cache. The cache does not have any automated management and provides only low-level access.- Specified by:
getCachein interfaceObjectCacheManager<T>- Returns:
- ObjectCache the cache implementation
-
setCache
public void setCache(ObjectCache<T> objectCache)
Description copied from interface:ObjectCacheManagerSet the underlaying cache implementation- Specified by:
setCachein interfaceObjectCacheManager<T>- Parameters:
objectCache- the cache implementation
-
fetch
public T fetch(ObjectKey<T> objectKey)
Description copied from interface:ObjectCacheManagerLooks for the object under the givenObjectKey. There are three possibilities:
When the object is found, it will be returned.
When no object is found, theObjectCreatorcreates a new one. The newly created object will be put on the cache and returned.
When the signature of the objectKey is outdated, the appropriate cached object (when available) will be removed. The keys signature will be renewed, theObjectCreatorcreates a new object which is put on the cache and returned.- Specified by:
fetchin interfaceObjectCacheManager<T>- Parameters:
objectKey- ObjectKey- Returns:
- cached object.
-
invalidate
public void invalidate(ObjectKey<T> objectKey)
Description copied from interface:ObjectCacheManagerInvalidates the object under the given (@link ObjectKey}- Specified by:
invalidatein interfaceObjectCacheManager<T>- Parameters:
objectKey- the object key
-
handleExpiration
protected void handleExpiration(ObjectKey<T> objectKey)
Default implementation simply removes the expired object.- Parameters:
objectKey-
-
handleInvalidation
protected void handleInvalidation(ObjectKey<T> objectKey)
Default implementation simply removed the invalidated object.- Parameters:
objectKey-
-
handleRequest
protected T handleRequest(ObjectKey<T> objectKey)
Default implementation simply requests the cache with the given key.- Parameters:
objectKey-
-
handleCreation
protected T handleCreation(ObjectKey<T> objectKey)
Default implementation of how objects should be created. This implementation calls the ObjectCreator (objectkey.getObjectCreator()) to create the object and puts this object into the cache.- Parameters:
objectKey- the objectkey- Returns:
- the created object which has been put into the cache
-
-