DEPRECATED
Object
HttpSessionBindingListener, Serializable
An object to help with caching content.
This object can placed anywhere for use as a cache. For convience, the
getContentCache method can be used with a JSP
PageContext to create and utilize ContentCaches.
Additionally, this is what the SelectTag and
SelectByIdTag tags use when useCache="true".>
Object
ContentCache
EventListener, HttpSessionBindingListener, Serializable
Field Summary |
protected |
|
public static final |
|
public static final |
|
Constructor Summary |
|
Method Summary |
public static void |
|
public synchronized void |
|
public static |
|
public synchronized long |
|
public synchronized |
|
public synchronized long |
|
public synchronized |
|
public static |
|
public static |
|
public static |
|
public synchronized int |
|
public static |
|
public synchronized | |
public static void |
|
public static void |
|
public synchronized void | |
public void |
|
public void |
|
Methods from class java.lang. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods from interface javax.servlet.http. |
valueBound, valueUnbound |
Field Detail |
protected Map cache
public static final String DEF_CACHE_NAME
When the getContentCache method is used,
this is the name which will used.
public static final String SESSION_NAME
This is set to DEF_CACHE_NAME.
Constructor Detail |
public ContentCache()
Method Detail |
public static void bindToSession(Bind a ContentCache into an HttpSession.ContentCachecache,HttpSessionsession)
This will use DEF_CACHE_NAME as the session
attribute name for the cache.
public synchronized void clear()Clear the entire cache.
public staticGet a scoped attribute correctly from the JSP page context.ObjectgetAttribute(PageContextctx,Stringname, int scope)
public synchronized long getCachedTime(String id)
Get the UTC time (in ms.) of when the Content at id was cached.
public synchronized List getCacheIds()
Get an unordered list of all the cache ids.
Since the keys will all be Strings, this can be sorted with
Collections.sort(List).
public synchronized long getCacheSize()Get the total number of Content objects cached (across all ids).
public synchronizedCheck the cache for the content.Content[] getContent(Stringid, long timeout)
Getting content from the cache does not update its time in terms of
a timeout. Only using the ContentCache.update(String, Content[]) method to update the cache
will do that.
public staticGet a ContentCache from the specified JSP context.ContentCachegetContentCache(PageContextctx, int scope, boolean create)
This will retrieve the ContentCache from the JSP context based upon
the specified scope at the attribute named
DEF_CACHE_NAME. If that is set and is not a
ContentCache, it will be removed.
public staticGet a ContentCache from the specified JSP context.ContentCachegetContentCache(PageContextctx,StringscopeStr, boolean create)
If scopeStr is "application", then PageContext.APPLICATION_SCOPE is used; if scopeStr is "page", then PageContext.PAGE_SCOPE is used; if scopeStr is "request", then PageContext.REQUEST_SCOPE is used; if scopeStr is "session", then PageContext.SESSION_SCOPE is used; otherwise, scopeStr is passed to ctx.getAttributesScope() which will determine the scope to use.
public staticGet a ContentCache from an HttpSession.ContentCachegetFromSession(HttpSessionsession, boolean create)
This will retrieve the cache from the session attribute named
DEF_CACHE_NAME. If that is set and is not a
ContentCache, it will be removed.
public synchronized int getNumCacheIds()Get the number of cache ids in the cache.
public static String getScopeName(int scope)
Get the scope name based upon the scope id.
public synchronizedClear a particular entry from the cache.Content[] remove(Stringid)
public static void removeAttribute(Remove a scoped attribute correctly from the JSP page context.PageContextctx,Stringname, int scope)
public static void setAttribute(Set a scoped attribute correctly in the JSP page context.PageContextctx,Stringname,Objectval, int scope)
public synchronized void update(Update the cache with the content.Stringid,Content[] content)
This can be used for new or existing content in the cache.
public void valueBound(HttpSessionBindingEvent evt)
Called when we're bound into an HttpSession.
public void valueUnbound(HttpSessionBindingEvent evt)
Called when we're unbound from an HttpSession, and clears the cache.
Related Topics