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
FieldsModifier and TypeFieldDescriptionprotected CacheTemplatestatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected CachingOptions -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract booleandoExists(Context context, CachingOptions cachingOptions, String path) protected abstract ContentdoFindContent(Context context, CachingOptions cachingOptions, String path) protected abstract ItemdoFindItem(Context context, CachingOptions cachingOptions, String path, boolean withDescriptor) doFindItems(Context context, CachingOptions cachingOptions, String path) booleanexists(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) voidsetCacheTemplate(CacheTemplate cacheTemplate) voidsetDefaultCachingOptions(CachingOptions defaultCachingOptions) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
existsin interfaceContentStoreAdapter- Throws:
InvalidContextExceptionStoreException
-
findContent
public Content findContent(Context context, CachingOptions cachingOptions, String path) throws InvalidContextException, StoreException - Specified by:
findContentin interfaceContentStoreAdapter- Throws:
InvalidContextExceptionStoreException
-
findItem
public Item findItem(Context context, CachingOptions cachingOptions, String path, boolean withDescriptor) throws InvalidContextException, XmlFileParseException, StoreException - Specified by:
findItemin interfaceContentStoreAdapter- Throws:
InvalidContextExceptionXmlFileParseExceptionStoreException
-
findItems
public List<Item> findItems(Context context, CachingOptions cachingOptions, String path) throws InvalidContextException, XmlFileParseException, StoreException - Specified by:
findItemsin interfaceContentStoreAdapter- Throws:
InvalidContextExceptionXmlFileParseExceptionStoreException
-
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
-