|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.extensions.surf.cache.BasicCache
org.springframework.extensions.surf.cache.PersistentCache
public class PersistentCache
This is a more advanced version of a cache that passivates objects to disk. If objects are cleaned out of the WeakHashMap, they are still retained on disk and can be reloaded from disk. Thus, the disk provides the true "persistent" cache and the in-memory cache still exists for performance purposes.
| Field Summary |
|---|
| Fields inherited from class org.springframework.extensions.surf.cache.BasicCache |
|---|
cache, timeout |
| Constructor Summary | |
|---|---|
PersistentCache(long default_timeout,
String cacheDir)
Instantiates a new persistent cache. |
|
| Method Summary | |
|---|---|
protected boolean |
existsOnDisk(String pathID)
Returns whether the disk-cached object for the given pathID exists. |
Object |
get(String key)
Gets content stored in the cache |
protected File |
getCacheFile(String pathID)
Returns the literal java.io.File path for the given path ID. |
protected CacheItem |
loadFromDisk(String pathID)
Loads a content item from disk if it exists. |
void |
put(String key,
Object obj,
long timeout)
Places content into the cache |
void |
remove(String key)
Removes a content object from the cache. |
protected void |
removeFromDisk(String pathID)
Removes a content item cached file from disk for the given path id. |
protected boolean |
writeToDisk(String pathID,
CacheItem item)
Serializes the given content item to disk for the given path string. |
| Methods inherited from class org.springframework.extensions.surf.cache.BasicCache |
|---|
invalidate, keys, put, values |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PersistentCache(long default_timeout,
String cacheDir)
default_timeout - the default_timeoutcacheDir - the cache dir| Method Detail |
|---|
public Object get(String key)
ContentCache
get in interface ContentCacheget in class BasicCachekey - the key
public void remove(String key)
ContentCache
remove in interface ContentCacheremove in class BasicCachekey - the key
public void put(String key,
Object obj,
long timeout)
ContentCache
put in interface ContentCacheput in class BasicCachekey - the keyobj - the objtimeout - the timeout in millisecondsprotected boolean existsOnDisk(String pathID)
pathID - the path id
protected CacheItem loadFromDisk(String pathID)
pathID - the path id
protected boolean writeToDisk(String pathID,
CacheItem item)
pathID - the path iditem - the item
protected void removeFromDisk(String pathID)
pathID - the path idprotected File getCacheFile(String pathID)
pathID - the path id
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||