org.springframework.extensions.surf.cache
Class ModelObjectCache

java.lang.Object
  extended by org.springframework.extensions.surf.cache.BasicCache<ModelObject>
      extended by org.springframework.extensions.surf.cache.ModelObjectCache
All Implemented Interfaces:
ContentCache<ModelObject>

public class ModelObjectCache
extends BasicCache<ModelObject>

An enhancement to the in-memory basic cache that considers the in-memory cache to be secondary to the status of content within a persisted store. The persisted store is a Store implementation that is checked in order to verify that the content is still valid in the cache. The delay between checks against the persistent store can be configured.

Author:
muzquiano, kevinr

Nested Class Summary
static class ModelObjectCache.ModelObjectSentinel
          Singleton sentinel class used to represent a 'null' value in the cache
 
Field Summary
protected  Store store
           
 
Fields inherited from class org.springframework.extensions.surf.cache.BasicCache
cache
 
Constructor Summary
ModelObjectCache(Store store, long delay)
          Instantiates a new model object cache.
ModelObjectCache(Store store, long timeout, long delay)
          Instantiates a new model object cache.
 
Method Summary
 ModelObject get(String key)
          Gets content stored in the cache
 
Methods inherited from class org.springframework.extensions.surf.cache.BasicCache
invalidate, keys, put, put, remove, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

store

protected final Store store
Constructor Detail

ModelObjectCache

public ModelObjectCache(Store store,
                        long delay)
Instantiates a new model object cache.

Parameters:
store - the store
delay - the delay to check modified dates for items in the cache

ModelObjectCache

public ModelObjectCache(Store store,
                        long timeout,
                        long delay)
Instantiates a new model object cache.

Parameters:
store - the store
timeout - the timeout
delay - the delay to check modified dates for items in the cache
Method Detail

get

public ModelObject get(String key)
Description copied from interface: ContentCache
Gets content stored in the cache

Specified by:
get in interface ContentCache<ModelObject>
Overrides:
get in class BasicCache<ModelObject>
Parameters:
key - the key
Returns:
the object


Copyright © 2009 SpringSource, Inc. All Rights Reserved.