com.opensymphony.oscache.web.tag
Class FlushTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by com.opensymphony.oscache.web.tag.FlushTag
All Implemented Interfaces:
Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.Tag

public class FlushTag
extends javax.servlet.jsp.tagext.TagSupport

FlushTag flushes caches created with <cache>. This tag provides programmatic control over when caches are flushed, and can flush all caches at once.

Usage Examples:


 <%@ taglib uri="oscache" prefix="cache" %>
 <cache:flush scope="application" />
 <cache:flush scope="session" key="foobar" />
 
Note: If no scope is provided (or scope is null), it will flush all caches globally - use with care!

Flushing is done by setting an appropriate application level time, which <cache> always looks at before retrieving the cache. If this 'flush time' is > that cache's last update, it will refresh the cache.

As such caches are not all 'flushed', they are all marked to be refreshed at their next access. That is the only way that the content can still be available if the refresh fails.

Version:
$Revision: 254 $
Author:
Mike Cannon-Brookes, Chris Miller
See Also:
Serialized Form

Field Summary
(package private)  ServletCacheAdministrator admin
           
(package private)  int cacheScope
           
(package private)  String group
          A cache group.
(package private)  String key
          Tag key.
private  String language
          The ISO-639 language code to distinguish different pages in application scope.
(package private)  String pattern
          if pattern value is specified, all keys that contain the pattern are flushed.
(package private)  String scope
           
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
FlushTag()
           
 
Method Summary
 int doStartTag()
          Process the start of the tag.
 void setGroup(String group)
          The group to be flushed.
 void setKey(String value)
          The key to be flushed.
 void setLanguage(String value)
          Set the ISO-639 language code to distinguish different pages in application scope.
 void setPattern(String value)
          The key pattern to be flushed.
 void setScope(String value)
          Set the scope of this flush.
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

admin

ServletCacheAdministrator admin

group

String group
A cache group. If specified, all content in that group will be flushed


key

String key
Tag key.


pattern

String pattern
if pattern value is specified, all keys that contain the pattern are flushed.


scope

String scope

cacheScope

int cacheScope

language

private String language
The ISO-639 language code to distinguish different pages in application scope.

Constructor Detail

FlushTag

public FlushTag()
Method Detail

setGroup

public void setGroup(String group)
The group to be flushed. If specified, all cached content in the group will be flushed.

Parameters:
group - The name of the group to flush.

setKey

public void setKey(String value)
The key to be flushed. If specified, only one cache entry will be flushed.

Parameters:
value - The key of the specific entry to flush.

setLanguage

public void setLanguage(String value)
Set the ISO-639 language code to distinguish different pages in application scope.

Parameters:
value - The language code for this cache entry.

setPattern

public void setPattern(String value)
The key pattern to be flushed. If specified, all entries that contain the pattern will be flushed.

Parameters:
value - The key of the specific entry to flush.

setScope

public void setScope(String value)
Set the scope of this flush.

Parameters:
value - The scope - either "application" (default) or "session".

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspTagException
Process the start of the tag.

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class javax.servlet.jsp.tagext.TagSupport
Returns:
The standard Tag return.
Throws:
javax.servlet.jsp.JspTagException - The standard tag exception thrown.


Copyright © 2011 OpenSymphony. All Rights Reserved.