org.springframework.extensions.surf.persister
Class AbstractCachedObjectPersister
java.lang.Object
org.springframework.extensions.surf.persister.AbstractObjectPersister
org.springframework.extensions.surf.persister.AbstractCachedObjectPersister
- All Implemented Interfaces:
- org.springframework.beans.factory.BeanNameAware, ModelObjectPersister
- Direct Known Subclasses:
- ReadOnlyStoreObjectPersister
public abstract class AbstractCachedObjectPersister
- extends AbstractObjectPersister
Extends the abstract implementation by offering a caching layer.
The caching layer is tiered intentionally to allow for composite keys
formed from a combination of store ids and object type ids.
The objective is to allow persisters to interrogate the cache and ask for
objects of a specified type in the current store context. The store context
is allowed to shift in the Web Framework runtime and the cache must be
sensitive to that.
- Author:
- muzquiano, kevinr
Methods inherited from class org.springframework.extensions.surf.persister.AbstractObjectPersister |
disable, getId, getServiceRegistry, getWebFrameworkConfiguration, getWebFrameworkManager, hasObject, init, isEnabled, removeObject, reset, setBeanName, setServiceRegistry |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GLOBAL_STORE_ID
protected static String GLOBAL_STORE_ID
caches
protected Map<String,BasicCache<ModelObject>> caches
useCache
protected boolean useCache
cacheDelay
protected long cacheDelay
AbstractCachedObjectPersister
public AbstractCachedObjectPersister()
getCache
protected BasicCache<ModelObject> getCache(ModelPersistenceContext context,
String objectTypeId)
- Gets the cache for a particular model persistence context
- Parameters:
context
- objectTypeId
-
- Returns:
- the cache
createCache
protected BasicCache<ModelObject> createCache()
- Creates the cache.
- Returns:
- the basic cache< model object>
cacheGet
protected ModelObject cacheGet(ModelPersistenceContext context,
String objectTypeId,
String objectId)
- Returns an object from the cache
- Parameters:
context
- the contextobjectTypeId
- objectId
-
- Returns:
- the model object
cachePut
protected void cachePut(ModelPersistenceContext context,
ModelObject obj)
- Places an object into this persister's cache.
- Parameters:
context
- the contextobj
- the obj
cacheRemove
protected void cacheRemove(ModelPersistenceContext context,
String objectTypeId,
String objectId)
- Removes an object from the cache
- Parameters:
context
- the contextobjectTypeId
- objectId
-
setCache
public void setCache(boolean useCache)
setCacheCheckDelay
public void setCacheCheckDelay(int cacheCheckDelay)
invalidateCache
public void invalidateCache()
Copyright © 2009 SpringSource, Inc. All Rights Reserved.