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
AbstractContentStoreAdapter
that provides caching to actual implementations. Subclasses just have to implement thedo*
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
Fields Modifier and Type Field Description protected CacheTemplate
cacheTemplate
static String
CONST_KEY_ELEM_CONTENT
static String
CONST_KEY_ELEM_EXISTS
static String
CONST_KEY_ELEM_ITEM
static String
CONST_KEY_ELEM_ITEMS
protected CachingOptions
defaultCachingOptions
-
Constructor Summary
Constructors Constructor Description AbstractCachedContentStoreAdapter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected 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)
protected abstract List<Item>
doFindItems(Context context, CachingOptions cachingOptions, String path)
boolean
exists(Context context, CachingOptions cachingOptions, String path)
Content
findContent(Context context, CachingOptions cachingOptions, String path)
Item
findItem(Context context, CachingOptions cachingOptions, String path, boolean withDescriptor)
List<Item>
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 Detail
-
CONST_KEY_ELEM_CONTENT
public static final String CONST_KEY_ELEM_CONTENT
- See Also:
- Constant Field Values
-
CONST_KEY_ELEM_ITEM
public static final String CONST_KEY_ELEM_ITEM
- See Also:
- Constant Field Values
-
CONST_KEY_ELEM_ITEMS
public static final String CONST_KEY_ELEM_ITEMS
- See Also:
- Constant Field Values
-
CONST_KEY_ELEM_EXISTS
public static final String CONST_KEY_ELEM_EXISTS
- See Also:
- Constant Field Values
-
cacheTemplate
protected CacheTemplate cacheTemplate
-
defaultCachingOptions
protected CachingOptions defaultCachingOptions
-
-
Method Detail
-
setCacheTemplate
public void setCacheTemplate(CacheTemplate cacheTemplate)
-
setDefaultCachingOptions
public void setDefaultCachingOptions(CachingOptions defaultCachingOptions)
-
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
-
-