|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.web.PathMapCache
Maintains a mapping of URL fragments to objects.
Constructor Summary | |
protected |
PathMapCache(String cacheID)
|
Method Summary | |
protected void |
clearAll()
|
protected Object |
get(String path)
Returns the object mapped to the normalized
path or its longest possible subpath. |
protected boolean |
isCached(String path)
|
protected abstract String |
normalize(String path)
Given a path like "/foo/bar/baz/quux" , returns either
"/foo/bar/baz/" or "/foo/bar/baz/quux/" . |
protected void |
put(String path,
Object value)
|
protected abstract void |
refresh()
|
protected void |
refreshAfterCommit()
Sets up and tears down the context in which refresh() can be
run. |
protected abstract Object |
retrieve(String path)
This method is called when PathMapCache cannot find a cached
value mapped to this path . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected PathMapCache(String cacheID)
IllegalArgumentException
- if cacheID
is not a
globally unique identifer.CacheTable.CacheTable(String)
Method Detail |
protected final Object get(String path)
normalized
path
or its longest possible subpath. May return
null
.
If no object is cached in memory for this path
or any of
its subpaths, this method will try to retrieve the object by delegating
to retrieve(String)
. If retrieval returns a non-null object, it
will be cached in memory so that subsequent calls to get
do
not have to call retrieve
again.
protected boolean isCached(String path)
protected void put(String path, Object value)
protected void clearAll()
protected void refreshAfterCommit()
refresh()
can be
run. If you need to update the cache after one of your previously cached
(persistent) objects changes, then you should implement refresh()
and call refreshAfterCommit
in your persistent
object's DomainObject.beforeSave()
and/or
DomainObject.afterDelete()
methods.
protected abstract String normalize(String path)
"/foo/bar/baz/quux"
, returns either
"/foo/bar/baz/"
or "/foo/bar/baz/quux/"
.
protected abstract Object retrieve(String path)
PathMapCache
cannot find a cached
value mapped to this path
. If the returned value is not
null, it will be cached. Therefore, care must be taken to ensure that
the value is cacheable across transactions. (For example, if you the
value returned by this method is a DataObject
, it must be
disconnected before being returned.)
protected abstract void refresh()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |