Package org.craftercms.core.store.impl
Class AbstractCachedContentStoreAdapter
java.lang.Object
org.craftercms.core.store.impl.AbstractCachedContentStoreAdapter
- All Implemented Interfaces:
ContentStoreAdapter
- Direct Known Subclasses:
AbstractFileBasedContentStoreAdapter
public abstract class AbstractCachedContentStoreAdapter
extends Object
implements ContentStoreAdapter
Abstract
ContentStoreAdapter
that provides caching to actual implementations. Subclasses just have to
implement the do*
methods to provide the cacheable objects. Caching works the following way: when an
interface method is called, and there's no cached object associated to the parameter-based compound key, the do*
method of the same name is called to execute the actual method code. The returned object is then cached with the
compound key.- Author:
- Alfonso Vásquez
-
Field Summary
Modifier and TypeFieldDescriptionprotected CacheTemplate
static final String
static final String
static final String
static final String
protected CachingOptions
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract boolean
doExists
(Context context, CachingOptions cachingOptions, String path) protected abstract Content
doFindContent
(Context context, CachingOptions cachingOptions, String path) protected abstract Item
doFindItem
(Context context, CachingOptions cachingOptions, String path, boolean withDescriptor) doFindItems
(Context context, CachingOptions cachingOptions, String path) boolean
exists
(Context context, CachingOptions cachingOptions, String path) findContent
(Context context, CachingOptions cachingOptions, String path) findItem
(Context context, CachingOptions cachingOptions, String path, boolean withDescriptor) findItems
(Context context, CachingOptions cachingOptions, String path) void
setCacheTemplate
(CacheTemplate cacheTemplate) void
setDefaultCachingOptions
(CachingOptions defaultCachingOptions) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.craftercms.core.store.ContentStoreAdapter
createContext, destroyContext, validate
-
Field Details
-
CONST_KEY_ELEM_CONTENT
- See Also:
-
CONST_KEY_ELEM_ITEM
- See Also:
-
CONST_KEY_ELEM_ITEMS
- See Also:
-
CONST_KEY_ELEM_EXISTS
- See Also:
-
cacheTemplate
-
defaultCachingOptions
-
-
Constructor Details
-
AbstractCachedContentStoreAdapter
public AbstractCachedContentStoreAdapter()
-
-
Method Details
-
setCacheTemplate
-
setDefaultCachingOptions
-
exists
public boolean exists(Context context, CachingOptions cachingOptions, String path) throws InvalidContextException, StoreException - Specified by:
exists
in interfaceContentStoreAdapter
- Throws:
InvalidContextException
StoreException
-
findContent
public Content findContent(Context context, CachingOptions cachingOptions, String path) throws InvalidContextException, StoreException - Specified by:
findContent
in interfaceContentStoreAdapter
- Throws:
InvalidContextException
StoreException
-
findItem
public Item findItem(Context context, CachingOptions cachingOptions, String path, boolean withDescriptor) throws InvalidContextException, XmlFileParseException, StoreException - Specified by:
findItem
in interfaceContentStoreAdapter
- Throws:
InvalidContextException
XmlFileParseException
StoreException
-
findItems
public List<Item> findItems(Context context, CachingOptions cachingOptions, String path) throws InvalidContextException, XmlFileParseException, StoreException - Specified by:
findItems
in interfaceContentStoreAdapter
- Throws:
InvalidContextException
XmlFileParseException
StoreException
-
doExists
protected abstract boolean doExists(Context context, CachingOptions cachingOptions, String path) throws InvalidContextException, StoreException -
doFindContent
protected abstract Content doFindContent(Context context, CachingOptions cachingOptions, String path) throws InvalidContextException, StoreException -
doFindItem
protected abstract Item doFindItem(Context context, CachingOptions cachingOptions, String path, boolean withDescriptor) throws InvalidContextException, XmlFileParseException, StoreException -
doFindItems
protected abstract List<Item> doFindItems(Context context, CachingOptions cachingOptions, String path) throws InvalidContextException, XmlFileParseException, StoreException
-