java.lang.Object
org.roller.presentation.pagecache.CommonsPageCache
- All Implemented Interfaces:
- FilterHandler
- public class CommonsPageCache
- extends java.lang.Object
- implements FilterHandler
Implementation of the PageCache, using Commons Cache. The extra benefit here
is that we can group the pages by the requested page's username (the user
that the page belongs to). We can then use this later to clear only the
cache item's for that user (i.e. when the user updates their site) and not
have to clear ALL pages in the cache.
A "seperate" cache is maintained for each logged in user (this allows the
"edit" links to be displayed).
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
mLogger
private static org.apache.commons.logging.Log mLogger
CACHENAME
private static final java.lang.String CACHENAME
- See Also:
- Constant Field Values
mFilterConfig
private javax.servlet.FilterConfig mFilterConfig
mMaxObjects
private int mMaxObjects
- number of objects to store in the cache, older objects
are pushed out (acts like LRU) if maxObjects reached.
mTime
private int mTime
- time objects are in cache before they expire - default one hour.
Configuration parameter is in seconds which we convert
to milliseconds.
CommonsPageCache
public CommonsPageCache(javax.servlet.FilterConfig arg0)
doFilter
public void doFilter(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse resp,
javax.servlet.FilterChain chain)
throws java.io.IOException,
javax.servlet.ServletException
- Description copied from interface:
FilterHandler
- Exactly as Filter.doFilter().
- Specified by:
doFilter in interface FilterHandler
flushCache
public void flushCache(javax.servlet.http.HttpServletRequest req)
- Description copied from interface:
FilterHandler
- Clear the entire cache.
- Specified by:
flushCache in interface FilterHandler
removeFromCache
public void removeFromCache(javax.servlet.http.HttpServletRequest req,
org.roller.pojos.UserData user)
- Description copied from interface:
FilterHandler
- Remove the entries for this User
from the cache.
- Specified by:
removeFromCache in interface FilterHandler
destroy
public void destroy()
- Description copied from interface:
FilterHandler
- Clean up anything necessary before destruction.
- Specified by:
destroy in interface FilterHandler
getCache
public Cache getCache()
- Get the cache for Pages. If none, create one.
Uses Commons Cache CacheConfig object to read a configuration file,
failing that creates one using the values from the Filter's initialization.