public class DefaultCacheTemplate extends Object implements CacheTemplate
| Constructor and Description |
|---|
DefaultCacheTemplate() |
| Modifier and Type | Method and Description |
|---|---|
protected <T> T |
doGet(Context context,
org.craftercms.commons.lang.Callback<T> callback,
Object key) |
protected <T> T |
doPut(Context context,
CachingOptions cachingOptions,
org.craftercms.commons.lang.Callback<T> callback,
Object key,
T obj) |
protected <T> CacheLoader |
getCacheLoader(org.craftercms.commons.lang.Callback<T> callback,
long refreshFrequency) |
CacheService |
getCacheService()
Returns the underlying cache service used.
|
Object |
getKey(Object... keyElements)
Creates a key from the specified elements
|
<T> T |
getObject(Context context,
CachingOptions cachingOptions,
org.craftercms.commons.lang.Callback<T> callback,
Object... keyElements)
Executes the template, using the specified callback to load the object to cache, if it's not already in the
cache.
|
<T> T |
getObject(Context context,
org.craftercms.commons.lang.Callback<T> callback,
Object... keyElements)
Executes the template, using the specified callback to load the object to cache, if it's not already in the
cache.
|
protected void |
logGetFailure(Context context,
org.craftercms.commons.lang.Callback<?> callback,
Object key,
Exception e) |
protected void |
logPutFailure(Context context,
org.craftercms.commons.lang.Callback<?> callback,
Object key,
Object obj,
Exception e) |
void |
setCacheService(CacheService cacheService) |
public CacheService getCacheService()
CacheTemplategetCacheService in interface CacheTemplatepublic void setCacheService(CacheService cacheService)
public Object getKey(Object... keyElements)
CacheTemplategetKey in interface CacheTemplatekeyElements - the key elementspublic <T> T getObject(Context context, org.craftercms.commons.lang.Callback<T> callback, Object... keyElements)
CacheTemplateCacheTemplate.getObject(org.craftercms.core.service.Context,
org.craftercms.core.service.CachingOptions, org.craftercms.commons.lang.Callback, Object...), but with
default caching options.getObject in interface CacheTemplatecontext - the context (needed by the cache service)callback - the callback to use in case the object is not in the cachekeyElements - the key elements, used to create the final cache keypublic <T> T getObject(Context context, CachingOptions cachingOptions, org.craftercms.commons.lang.Callback<T> callback, Object... keyElements)
CacheTemplategetObject in interface CacheTemplatecontext - the context (needed by the cache service)cachingOptions - the options used for caching.callback - the callback to use in case the object is not in the cachekeyElements - the key elements, used to create the final cache keyprotected <T> T doGet(Context context, org.craftercms.commons.lang.Callback<T> callback, Object key)
protected <T> T doPut(Context context, CachingOptions cachingOptions, org.craftercms.commons.lang.Callback<T> callback, Object key, T obj)
protected <T> CacheLoader getCacheLoader(org.craftercms.commons.lang.Callback<T> callback, long refreshFrequency)
protected void logGetFailure(Context context, org.craftercms.commons.lang.Callback<?> callback, Object key, Exception e)
Copyright © 2018 CrafterCMS. All rights reserved.