Class DefaultRenderingCacheService<T extends java.io.Serializable>
- java.lang.Object
-
- de.hybris.platform.cmsfacades.rendering.cache.impl.DefaultRenderingCacheService<T>
-
- All Implemented Interfaces:
RenderingCacheService<T>
public class DefaultRenderingCacheService<T extends java.io.Serializable> extends java.lang.Object implements RenderingCacheService<T>
Default implementation ofRenderingCacheService
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCMS_RENDERING_CACHE_ENABLED_KEY
-
Constructor Summary
Constructors Constructor Description DefaultRenderingCacheService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancacheEnabled()Verifies whether the cache is enabled or not.TcacheOrElse(ItemModel item, java.util.function.Supplier<T> converter)Methods takes theItemModel, verifies that theSerializablerepresentation is cached and returns it.java.util.Optional<T>get(CacheKey key)Returns cachedSerializable.CacheControllergetCacheController()RenderingCacheKeyProvider<ItemModel>getCacheKeyProvider()ConfigurationServicegetConfigurationService()java.util.Optional<CacheKey>getKey(ItemModel item)Retrieves the key that must be used to cacheSerializable.SessionServicegetSessionService()voidput(CacheKey key, java.io.Serializable item)Puts theSerializableinto the cache using provided key.voidsetCacheController(CacheController cacheController)voidsetCacheKeyProvider(RenderingCacheKeyProvider<ItemModel> cacheKeyProvider)voidsetConfigurationService(ConfigurationService configurationService)voidsetSessionService(SessionService sessionService)
-
-
-
Field Detail
-
CMS_RENDERING_CACHE_ENABLED_KEY
public static final java.lang.String CMS_RENDERING_CACHE_ENABLED_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
cacheEnabled
public boolean cacheEnabled()
Description copied from interface:RenderingCacheServiceVerifies whether the cache is enabled or not.- Specified by:
cacheEnabledin interfaceRenderingCacheService<T extends java.io.Serializable>- Returns:
- true if cache is enabled, false otherwise
-
put
public void put(CacheKey key, java.io.Serializable item)
Description copied from interface:RenderingCacheServicePuts theSerializableinto the cache using provided key.- Specified by:
putin interfaceRenderingCacheService<T extends java.io.Serializable>- Parameters:
key- the key used to saveSerializableitem- theSerializablethat must be cached.
-
get
public java.util.Optional<T> get(CacheKey key)
Description copied from interface:RenderingCacheServiceReturns cachedSerializable.- Specified by:
getin interfaceRenderingCacheService<T extends java.io.Serializable>- Parameters:
key- the key used to retrieve cachedSerializable- Returns:
- optional cached
Serializable.
-
getKey
public java.util.Optional<CacheKey> getKey(ItemModel item)
Description copied from interface:RenderingCacheServiceRetrieves the key that must be used to cacheSerializable. The key is retrieved byItemModel.- Specified by:
getKeyin interfaceRenderingCacheService<T extends java.io.Serializable>- Parameters:
item- theItemModelfor which to retrieve the key.- Returns:
- the key
-
cacheOrElse
public T cacheOrElse(ItemModel item, java.util.function.Supplier<T> converter)
Description copied from interface:RenderingCacheServiceMethods takes theItemModel, verifies that theSerializablerepresentation is cached and returns it. If the item is not in the cache the converter is called andSerializablerepresentation is saved into the cache.- Specified by:
cacheOrElsein interfaceRenderingCacheService<T extends java.io.Serializable>- Parameters:
item- theItemModelto cache.converter- the converter to use if theItemModelis not in the cache.- Returns:
- the
Serializablerepresentation for rendering.
-
getCacheKeyProvider
public RenderingCacheKeyProvider<ItemModel> getCacheKeyProvider()
-
setCacheKeyProvider
public void setCacheKeyProvider(RenderingCacheKeyProvider<ItemModel> cacheKeyProvider)
-
getCacheController
public CacheController getCacheController()
-
setCacheController
public void setCacheController(CacheController cacheController)
-
getConfigurationService
public ConfigurationService getConfigurationService()
-
setConfigurationService
public void setConfigurationService(ConfigurationService configurationService)
-
getSessionService
public SessionService getSessionService()
-
setSessionService
public void setSessionService(SessionService sessionService)
-
-