|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--oracle.jsp.jwcache.CachePolicy
CachePolicy
is a class that represents a cache policy
in Oracle Java Web Cache. Apart from holding cache policy attributes,
such as, "selected parameters", expiration policy and cache repository
name, a CachePolicy
object also have methods for cache
operation, e.g. putCache
and getCache
to
store and get cache through the cache policy. A cache policy object
is constructed upon usage of OracleJSP cache tag. All cache operations
are performed through this CachePolicy
.
Field Summary |
Type | Field |
---|---|
static int |
AUTO_INVALIDATE_APP_LEVEL
AUTO_INVALIDATE_APP_LEVEL is the integer constant
that represents the application invalidate level for automatic naming
cache (i.e. |
static java.lang.String |
AUTO_INVALIDATE_APP_LEVEL_STR
AUTO_INVALIDATE_APP_LEVEL_STR is the string constant
that represents the application invalidate level for automatic naming
cache (i.e. |
static int |
AUTO_INVALIDATE_COOKIE_LEVEL
AUTO_INVALIDATE_COOKIE_LEVEL is the integer constant
that represents the cookie invalidate level for automatic naming
cache (i.e. |
static java.lang.String |
AUTO_INVALIDATE_COOKIE_LEVEL_STR
AUTO_INVALIDATE_COOKIE_LEVEL_STR is the string constant
that represents the cookie invalidate level for automatic naming
cache (i.e. |
static int |
AUTO_INVALIDATE_PAGE_LEVEL
AUTO_INVALIDATE_PAGE_LEVEL is the integer constant
that represents the page invalidate level for automatic naming
cache (i.e. |
static java.lang.String |
AUTO_INVALIDATE_PAGE_LEVEL_STR
AUTO_INVALIDATE_PAGE_LEVEL_STR is the string constant
that represents the page invalidate level for automatic naming
cache (i.e. |
static int |
AUTO_INVALIDATE_PARAM_LEVEL
AUTO_INVALIDATE_PARAM_LEVEL is the integer constant
that represents the parameter invalidate level for automatic naming
cache (i.e. |
static java.lang.String |
AUTO_INVALIDATE_PARAM_LEVEL_STR
AUTO_INVALIDATE_PARAM_LEVEL_STR is the string constant
that represents the parameter invalidate level for automatic naming
cache (i.e. |
static int |
AUTO_INVALIDATE_UNDEFINED
AUTO_INVALIDATE_UNDEFINED is the integer constant
that represents the undefined invalidate level for automatic naming
cache (i.e. |
static java.lang.String |
CACHE_POLICIES
internal name of the table of cache policy objects used in servlet context |
static java.lang.String |
CACHE_REPOS
internal name of the table of cache repository objects used in servlet context |
static java.lang.String |
CACHENAME_AUTO
the internal string constant used in generating the internal name of caches which is NOT under TYPE_USERSPECIFIED . |
static java.lang.String |
CACHENAME_USER
the internal string constant used in generating the internal name of caches which is under TYPE_USERSPECIFIED . |
static java.lang.String |
DEFAULT_REPO_NAME
the name of the default cache repository |
static int |
REUSABLE_ALWAYS
the integer constant to specify the cache is always reusable if it exists / it has not expired yet. |
static java.lang.String |
REUSABLE_IGNORED
the String constant used to specify "ignored" values in reusableTimeStamp and reusableDeltaTime |
static int |
SCOPE_APP
the integer constant to specify the scope of cache as application / servlet context |
static java.lang.String |
SCOPE_APP_STR
the string constant to specify the scope of cache as applcation / servlet context |
static int |
SCOPE_SESSION
the integer constant to specify the scope of cache as HTTP session |
static java.lang.String |
SCOPE_SESSION_STR
the string constant to specify the scope of cache as HTTP session |
static java.lang.String |
SECTION_ID
internal name of auto counter section id of JSP cache fragments used in pageContext |
static java.lang.String |
SESSION_CACHE_REPO
internal name of the HTTP-session-scoped cache repository used in HTTP session |
static java.lang.String[] |
TYPE_STRS
the array of string constants that represents different types of cache policy |
static int |
TYPE_URI_ALLPARAM
the integer constant to specify the cache policy type as URI plus all parameters naming |
static int |
TYPE_URI_EXCLUDEDPARAM
the integer constant to specify the cache policy type as URI plus excluded parameters naming |
static int |
TYPE_URI_ONLY
the integer constant to specify the cache policy type as URI only naming |
static int |
TYPE_URI_QUERYSTR
the integer constant to specify the cache policy type as URI plus query string naming |
static int |
TYPE_URI_SELECTEDPARAM
the integer constant to specify the cache policy type as URI plus selected parameters naming |
static int |
TYPE_USERSPECIFIED
the integer constant to specify the cache policy type as user specified naming |
Constructor Summary |
Type | Constructor |
---|---|
|
CachePolicy(CachePolicy cPolicy)
copy constructor of cache policy |
|
CachePolicy(javax.servlet.ServletConfig config)
Default cache policy constructor |
protected |
CachePolicy(javax.servlet.ServletConfig config,
boolean attrChanged,
boolean ignoreCache,
int scope,
int autoType,
java.lang.String[] selectedParameters,
java.lang.String[] selectedCookies,
long reusableTimeStamp,
long reusableDeltaTime,
ExpirationPolicy expirationPolicyObj,
java.lang.String repoName,
boolean reportException)
a protected cache policy constructor that accepts each member as an individual argument. |
|
CachePolicy(javax.servlet.ServletConfig config,
CachePolicy cPolicy)
copy constructor of cache policy with an overriding servlet config object. |
Method Summary |
Type | Method |
---|---|
static int |
autoInvalidateStrToLevelInt(java.lang.String s)
the convenient method to convert the AUTO INVALIDATE LEVEL
String to the corresponding the AUTO INVALIDATE LEVEL
integer constant, which is used in invalidateCacheLike
method. |
boolean |
getAttrChanged()
a public method used to check whether an attribute of cache policy is changed since construction / creation |
CacheBlock |
getAutoCacheForOtherPath(javax.servlet.http.HttpServletRequest req,
java.lang.String otherPath,
javax.servlet.http.Cookie[] newCookies,
StringSectionId sectionId)
get a cache entry for a specified string-based section id for the specified page path. |
CacheBlock |
getAutoCacheForOtherPath(javax.servlet.http.HttpServletRequest req,
java.lang.String otherPath,
StringSectionId sectionId)
get a cache entry for a specified string-based section id for the specified page path. |
int |
getAutoType()
to get the type of this cache policy. |
CacheBlock |
getCache(javax.servlet.http.HttpServletRequest req,
SectionId sectionId)
to get the cache block (as CacheBlock ) object) through
this cache policy. |
CacheBlock |
getCache(javax.servlet.http.HttpServletRequest req,
java.lang.String specifiedName)
to get the cache block (as CacheBlock ) object) through
this cache policy. |
CacheBlock |
getCache(javax.servlet.http.HttpServletRequest req,
java.lang.String specifiedName,
SectionId sectionId)
to get the cache block (as CacheBlock ) object) through
this cache policy. |
java.lang.String |
getCacheRepositoryName()
to get the cache repository name used in this cache policy |
java.util.Date |
getCurrentTime()
to get the current time from the cache repository specified in this cache policy. |
java.lang.String |
getDebugCacheName(javax.servlet.http.HttpServletRequest req,
java.lang.String specifiedName,
SectionId sectionId)
to generate the internal (for advanced debug purpose) cache name (most users do not need to call this function.) |
ExpirationPolicy |
getExpirationPolicy()
to get the expiration policy object |
boolean |
getIgnoreCache()
to check whether cache is always ignored |
boolean |
getReportException()
to get the value of reportException flag. |
long |
getReusableDeltaTime()
to get the reusable delta time |
java.util.Date |
getReusableTimeStamp()
to get the reusable time stamp |
int |
getScope()
to get the scope of the cache policy: session or application. |
java.lang.String[] |
getSelectedCookies()
to get the String array of selected cookies of this cache policy used in TYPE_URI_QUERYSTR , TYPE_URI_ALLPARAM ,
TYPE_URI_SELECTEDPARAM and
TYPE_URI_EXCLUDEDPARAM |
java.lang.String[] |
getSelectedParam()
to get the array of selected HTTP parameters of this cache policy used in TYPE_URI_SELECTEDPARAM and
TYPE_URI_EXCLUDEDPARAM . |
void |
invalidateCache(javax.servlet.http.HttpServletRequest req,
SectionId sectionId)
to invalidate the cache block object in the cache repository through this cache policy; the cache block object is identified by the passed-in parameters |
void |
invalidateCache(javax.servlet.http.HttpServletRequest req,
java.lang.String specifiedName)
to invalidate the cache block object in the cache repository through this cache policy; the cache block object is identified by the passed-in parameters |
void |
invalidateCache(javax.servlet.http.HttpServletRequest req,
java.lang.String specifiedName,
SectionId sectionId)
to invalidate the cache block object in the cache repository through this cache policy; the cache block object is identified by the passed-in parameters |
void |
invalidateCacheLike(javax.servlet.http.HttpServletRequest req,
int autoInvalidateLevel)
to invalidate a collection of cache blocks through this cache policy that matches with given paramaters |
void |
invalidateCacheLike(javax.servlet.http.HttpServletRequest req,
java.lang.String specifiedName)
to invalidate a collection of cache blocks through this cache policy that matches with given paramaters |
void |
invalidateCacheLike(javax.servlet.http.HttpServletRequest req,
java.lang.String specifiedName,
int autoInvalidateLevel)
to invalidate a collection of cache blocks through this cache policy that matches with given paramaters |
void |
invalidateCacheOtherPathLike(javax.servlet.http.HttpServletRequest req,
java.lang.String otherPath)
invalidate the caches of another page, not the one associated with the current request. |
void |
invalidateCacheOtherPathLike(javax.servlet.http.HttpServletRequest req,
java.lang.String otherPath,
javax.servlet.http.Cookie[] newCookies,
int autoInvalidateLevel)
invalidate the caches of another page, not the one associated with the current request. |
boolean |
isRecent(CacheBlock block)
to test with a cache block is recent enough to reuse according to the reusableTimeStamp and reusableDeltaTime
attribute, where reusableTimeStamp takes precedence over
reusableDeltaTime . |
void |
markupBegin(javax.servlet.ServletContext sc,
javax.servlet.http.HttpServletRequest req,
java.io.Writer out,
java.lang.String specifiedName,
SectionId sectionId)
an API to markup the beginning of a cache block; mainly for future integration with downstream level-3 caching; not being used by external users as of this version |
void |
markupEnd(javax.servlet.ServletContext sc,
javax.servlet.http.HttpServletRequest req,
java.io.Writer out,
java.lang.String specifiedName,
SectionId sectionId)
an API to markup the end of a cache block; mainly for future integration with downstream level-3 caching; not being used by external users as of this version |
static java.lang.String[] |
parseSpaceDelimitedString(java.lang.String s)
a convenient method to parse a space delimited String into a String array |
void |
putAutoCacheForOtherPath(java.lang.Object obj,
javax.servlet.http.HttpServletRequest req,
java.lang.String otherPath,
javax.servlet.http.Cookie[] newCookies,
StringSectionId sectionId)
put a cache entry for a specified string-based section id for the specified page path. |
void |
putAutoCacheForOtherPath(java.lang.Object obj,
javax.servlet.http.HttpServletRequest req,
java.lang.String otherPath,
StringSectionId sectionId)
put a cache entry for a specified string-based section id for the specified page path. |
void |
putCache(java.lang.Object obj,
javax.servlet.http.HttpServletRequest req,
SectionId sectionId)
to put an object into the cache repository through this cache policy. |
void |
putCache(java.lang.Object obj,
javax.servlet.http.HttpServletRequest req,
java.lang.String specifiedName)
to put an object into the cache repository through this cache policy. |
void |
putCache(java.lang.Object obj,
javax.servlet.http.HttpServletRequest req,
java.lang.String specifiedName,
SectionId sectionId)
to put an object into the cache repository through this cache policy. |
protected void |
resetAttrChanged()
a protected method used internally to mark an attribute of cache policy is NOT changed since construction / creation |
protected void |
setAttrChanged()
a protected method used internally to mark an attribute of cache policy is changed since construction / creation |
void |
setAutoType(int autoType)
to set the type of this cache policy with an integer parameter |
void |
setAutoType(java.lang.String s)
to set type of this cache policy with a String parameter |
void |
setCacheRepositoryName(java.lang.String repoName)
to set the cache repository name used in this cache policy (the definition of cache repository, including the name, is specified in /WEB-INF/wcache.xml) |
void |
setExpirationPolicy(ExpirationPolicy expirationPolicyObj)
to set the expiration policy of this cache policy |
void |
setIgnoreCache(boolean ignoreCache)
to set whether cache is always ignored |
void |
setIgnoreCache(java.lang.String v)
to set whether cache is always ignored |
void |
setReportException(boolean reportException)
to set whether a CacheRuntimeException is generated
during cache operations. |
void |
setReportException(java.lang.String reportExceptionStr)
to set whether a CacheRuntimeException is generated
during cache operations. |
void |
setReusableDeltaTime(long reusableDeltaTime)
to set the reusable delta time |
void |
setReusableDeltaTime(java.lang.String s)
to set the reusable delta time |
void |
setReusableTimeStamp(java.util.Date reusableTimeStamp)
to set the reusable time stamp |
void |
setReusableTimeStamp(long reusableTimeStamp)
to set the reusable time stamp |
void |
setReusableTimeStamp(java.lang.String s)
to set the reusable time stamp |
void |
setScope(int scope)
to set the scope of this cache policy: session or application with an integer parameter. |
void |
setScope(java.lang.String s)
to set the scope of this cache policy: session or application with a String parameter |
void |
setSelectedCookies(java.lang.String selectedCookiesStr)
to set the selected cookies of this cache policy used in TYPE_URI_QUERYSTR , TYPE_URI_ALLPARAM ,
TYPE_URI_SELECTEDPARAM and
TYPE_URI_EXCLUDEDPARAM |
void |
setSelectedCookies(java.lang.String[] selectedCookies)
to set the String array of selected cookies of this cache policy used in TYPE_URI_QUERYSTR , TYPE_URI_ALLPARAM ,
TYPE_URI_SELECTEDPARAM and
TYPE_URI_EXCLUDEDPARAM |
void |
setSelectedParam(java.lang.String selectedParamStr)
to set the selected HTTP parameters of this cache policy used in TYPE_URI_SELECTEDPARAM and
TYPE_URI_EXCLUDEDPARAM |
void |
setSelectedParam(java.lang.String[] selectedParameters)
to set the selected HTTP parameters of this cache policy used in TYPE_URI_SELECTEDPARAM and
TYPE_URI_EXCLUDEDPARAM |
static java.util.Enumeration |
sortEnum(java.util.Enumeration enum)
a convenient method to sort an Enumeration of Strings |
java.lang.String |
toString()
to generate the string of description of this cache policy in XML format |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final int SCOPE_SESSION
public static final int SCOPE_APP
public static final java.lang.String SCOPE_SESSION_STR
public static final java.lang.String SCOPE_APP_STR
public static final int TYPE_USERSPECIFIED
public static final int TYPE_URI_ONLY
public static final int TYPE_URI_QUERYSTR
public static final int TYPE_URI_ALLPARAM
public static final int TYPE_URI_SELECTEDPARAM
public static final int TYPE_URI_EXCLUDEDPARAM
public static final java.lang.String[] TYPE_STRS
public static final java.lang.String DEFAULT_REPO_NAME
public static final java.lang.String CACHE_REPOS
public static final java.lang.String CACHE_POLICIES
public static final java.lang.String SECTION_ID
public static final java.lang.String SESSION_CACHE_REPO
public static final int REUSABLE_ALWAYS
reusableTimeStamp
or reusableDeltaTime
.public static final java.lang.String REUSABLE_IGNORED
reusableTimeStamp
and reusableDeltaTime
public static final java.lang.String CACHENAME_USER
TYPE_USERSPECIFIED
.public static final java.lang.String CACHENAME_AUTO
TYPE_USERSPECIFIED
.public static final int AUTO_INVALIDATE_UNDEFINED
AUTO_INVALIDATE_UNDEFINED
is the integer constant
that represents the undefined invalidate level for automatic naming
cache (i.e. NON-TYPE_USERSPECIFIED).
Background
With automatic cache naming (i.e. NON-TYPE_USERSPECIFIED), any cache
block within a page will be stored under a hierachy. The hierarachy
has levels in the following sequence:
http://host1:port1/myapp/dir1/dir2/abc.jsp?p1=v1&p2=v2
Cookie: cookiename1=cookievalue1; cookiename2=cookievalue2
Cache blocks associated with this request will be stored under a hierarachy in the following sequence:
invalidateCacheLike
operation is performed with
an automatic naming cache policy, an invalidation level can be passed
as a parameter. When an invalidateCacheLike is performed with the
request of the above example with the invalidation level of:
public static final int AUTO_INVALIDATE_APP_LEVEL
AUTO_INVALIDATE_APP_LEVEL
is the integer constant
that represents the application invalidate level for automatic naming
cache (i.e. NON-TYPE_USERSPECIFIED). public static final int AUTO_INVALIDATE_PAGE_LEVEL
AUTO_INVALIDATE_PAGE_LEVEL
is the integer constant
that represents the page invalidate level for automatic naming
cache (i.e. NON-TYPE_USERSPECIFIED). public static final int AUTO_INVALIDATE_PARAM_LEVEL
AUTO_INVALIDATE_PARAM_LEVEL
is the integer constant
that represents the parameter invalidate level for automatic naming
cache (i.e. NON-TYPE_USERSPECIFIED). public static final int AUTO_INVALIDATE_COOKIE_LEVEL
AUTO_INVALIDATE_COOKIE_LEVEL
is the integer constant
that represents the cookie invalidate level for automatic naming
cache (i.e. NON-TYPE_USERSPECIFIED). public static final java.lang.String AUTO_INVALIDATE_APP_LEVEL_STR
AUTO_INVALIDATE_APP_LEVEL_STR
is the string constant
that represents the application invalidate level for automatic naming
cache (i.e. NON-TYPE_USERSPECIFIED). public static final java.lang.String AUTO_INVALIDATE_PAGE_LEVEL_STR
AUTO_INVALIDATE_PAGE_LEVEL_STR
is the string constant
that represents the page invalidate level for automatic naming
cache (i.e. NON-TYPE_USERSPECIFIED). public static final java.lang.String AUTO_INVALIDATE_PARAM_LEVEL_STR
AUTO_INVALIDATE_PARAM_LEVEL_STR
is the string constant
that represents the parameter invalidate level for automatic naming
cache (i.e. NON-TYPE_USERSPECIFIED). public static final java.lang.String AUTO_INVALIDATE_COOKIE_LEVEL_STR
AUTO_INVALIDATE_COOKIE_LEVEL_STR
is the string constant
that represents the cookie invalidate level for automatic naming
cache (i.e. NON-TYPE_USERSPECIFIED). Constructor Detail |
public CachePolicy(javax.servlet.ServletConfig config)
By default, the scope is application; type is "all parameters"; always resuse cache; using default expiration policy and default cache repository; report runtime exception.
config
- the servlet config object used in this cache policypublic CachePolicy(CachePolicy cPolicy)
public CachePolicy(javax.servlet.ServletConfig config, CachePolicy cPolicy)
This constructor will copy all fields of the given cache policy, except the servlet config object. This constructor will use the given servlet config object instead.
protected CachePolicy(javax.servlet.ServletConfig config, boolean attrChanged, boolean ignoreCache, int scope, int autoType, java.lang.String[] selectedParameters, java.lang.String[] selectedCookies, long reusableTimeStamp, long reusableDeltaTime, ExpirationPolicy expirationPolicyObj, java.lang.String repoName, boolean reportException)
Method Detail |
protected void setAttrChanged()
protected void resetAttrChanged()
public boolean getAttrChanged()
public boolean getIgnoreCache()
public void setIgnoreCache(boolean ignoreCache)
ignoreCache
- the boolean parameter of this setter methodpublic void setIgnoreCache(java.lang.String v)
ignoreCache
- the String parameter of this setter methodpublic int getScope()
Please refer to the SCOPE_*
constants defined in this class.
public void setScope(int scope)
Please refer to the SCOPE_*
constants defined in this class.
scope
- the integer parameter that set the scope of this cache policypublic void setScope(java.lang.String s)
Please refer to the SCOPE_*
constants defined in this class.
scope
- the String parameter that set the scope of this cache policypublic int getAutoType()
Please refer to the TYPE_*
constants defined in this class.
public void setAutoType(int autoType)
Please refer to the TYPE_*
constants defined in this class.
autoType
- the integer parameter that specifies the type of this
cache policypublic void setAutoType(java.lang.String s)
Please refer to the TYPE_*
constants defined in this class.
s
- the String parameter that specifies the type of this cache
policypublic static java.lang.String[] parseSpaceDelimitedString(java.lang.String s)
public java.lang.String[] getSelectedParam()
TYPE_URI_SELECTEDPARAM
and
TYPE_URI_EXCLUDEDPARAM
.public void setSelectedParam(java.lang.String[] selectedParameters)
TYPE_URI_SELECTEDPARAM
and
TYPE_URI_EXCLUDEDPARAM
selectedParameters
- the String array that specifies HTTP parameters
to set in this cache policypublic void setSelectedParam(java.lang.String selectedParamStr)
TYPE_URI_SELECTEDPARAM
and
TYPE_URI_EXCLUDEDPARAM
selectedParamStr
- the space delimited String that specifies a
list of HTTP parameters to set in this cache policypublic java.lang.String[] getSelectedCookies()
TYPE_URI_QUERYSTR
, TYPE_URI_ALLPARAM
,
TYPE_URI_SELECTEDPARAM
and
TYPE_URI_EXCLUDEDPARAM
public void setSelectedCookies(java.lang.String[] selectedCookies)
TYPE_URI_QUERYSTR
, TYPE_URI_ALLPARAM
,
TYPE_URI_SELECTEDPARAM
and
TYPE_URI_EXCLUDEDPARAM
selectedCookies
- the String array of selected cookies to setpublic void setSelectedCookies(java.lang.String selectedCookiesStr)
TYPE_URI_QUERYSTR
, TYPE_URI_ALLPARAM
,
TYPE_URI_SELECTEDPARAM
and
TYPE_URI_EXCLUDEDPARAM
selectedCookiesStr
- the space delimited String that specifies
the selected cookies to setpublic java.util.Date getReusableTimeStamp()
Reusable time stamp is different from TTL in expiration policy.
It does not affect the putCache
or getCache
operations. It does not affect the life span of cache.
It affects the result of isRecent
function, which is
used in JSP Java Web Cache tags (e.g. <ojsp:cache >).
If the creation time of cache is more recent than the reusable
time stamp, then that piece of cache will be recent enough
(i.e. isRecent
call) to be reused in JSP tags. Otherwise,
when this cache policy is used as JSP tags, the logic
of generating a fresh content will be re-executed. But,
the newly generated content will NOT replace the existing copy of cache.
public void setReusableTimeStamp(java.util.Date reusableTimeStamp)
For the semantics of reusable time stamp, please refer to
getReusableTimeStamp
reusableTimeStamp
- the java.util.Date
parameter to
set the reusable time stamp of this cache policy.public void setReusableTimeStamp(long reusableTimeStamp)
For the semantics of reusable time stamp, please refer to
getReusableTimeStamp
reusableTimeStamp
- the long
parameter to set the
reusable time stamp of this cache policy. The long value will be
converted to java.util.Date
internally.public void setReusableTimeStamp(java.lang.String s) throws java.text.ParseException
For the semantics of reusable time stamp, please refer to
getReusableTimeStamp
s
- the String
parameter to set the
reusable time stamp of this cache policy. The long value will be
converted to java.util.Date
internally with one of the
following date format strings:
yyyy.MM.dd hh:mm:ss z
yyyy.MM.dd hh:mm:ss
yyyy.MM.dd
public long getReusableDeltaTime()
Reusable delta time is similar reusable time stamp.
It is different from TTL in expiration policy.
It does not affect the putCache
or getCache
operations. It does not affect the life span of cache.
It affects the result of isRecent
function, which is
used in JSP Java Web Cache tags (e.g. <ojsp:cache >).
If the difference between the creation time of cache and the current time
is smaller than the reusable delta time,
then that piece of cache will be recent enough
(i.e. isRecent
call) to be reused in JSP tags. Otherwise,
when this cache policy is used as JSP tags, the logic
of generating a fresh content will be re-executed. But,
the newly generated content will NOT replace the existing copy of cache.
public void setReusableDeltaTime(long reusableDeltaTime)
For the semantics of reusable delta time, please refer to
getReusableDeltaTime
.
reusableDeltaTime
- the long parameter to set the reusable delta timepublic void setReusableDeltaTime(java.lang.String s) throws java.lang.NumberFormatException
For the semantics of reusable delta time, please refer to
getReusableDeltaTime
.
s
- the String parameter to set the reusable delta time; it will
accepts the special string constant - "ignored".public ExpirationPolicy getExpirationPolicy()
public void setExpirationPolicy(ExpirationPolicy expirationPolicyObj)
expirationPolicyObj
- the expiration policy object to setpublic void setCacheRepositoryName(java.lang.String repoName)
repoName
- the string parameter to specifiy the cache repository
name used in this cache policypublic java.lang.String getCacheRepositoryName()
public void setReportException(boolean reportException)
CacheRuntimeException
is generated
during cache operations.
e.g., getCache
, putCache
and
invalidateCache
.
If this attribute is true, an exception will be triggered.
Otherwise, the operation will fail silently and the error
message will be logged to the servlet context log
reportException
- the boolean parameter to setpublic void setReportException(java.lang.String reportExceptionStr)
CacheRuntimeException
is generated
during cache operations.
e.g., getCache
, putCache
and
invalidateCache
.
If this attribute is true, an exception will be triggered.
Otherwise, the operation will fail silently and the error message
will be logged to the servlet context log
reportExceptionStr
- the String parameter to setpublic boolean getReportException()
reportException
flag.
For the semantics of this flag, please refer to the javadoc
of setReportException
reportException
public java.lang.String toString()
public java.lang.String getDebugCacheName(javax.servlet.http.HttpServletRequest req, java.lang.String specifiedName, SectionId sectionId)
req
- the given HTTP servlet requestspecifiedName
- the given user specified name, when type is
TYPE_USERSPECIFIED
sectionId
- the given automatic cache block ID, when type is
NOT TYPE_USERSPECIFIED
public static java.util.Enumeration sortEnum(java.util.Enumeration enum)
public CacheBlock getCache(javax.servlet.http.HttpServletRequest req, java.lang.String specifiedName, SectionId sectionId)
CacheBlock
) object) through
this cache policy.
This is the comprehensive version of getCache
API.req
- the current HTTP servlet requestspecifiedName
- the user specified cache name used, when the type
of this cache policy is TYPE_USERSPECIFIED; it can be null, otherwisesectionId
- the automatic-increment cach block id used, when the
type of this cache policy is NOT TYPE_USERSPECIFIED; it can be
null, otherwisepublic CacheBlock getCache(javax.servlet.http.HttpServletRequest req, SectionId sectionId)
CacheBlock
) object) through
this cache policy.
This is the getCache
API for NON-TYPE_USERSPECIFIED
cache policies.req
- the current HTTP servlet requestsectionId
- the automatic-increment cach block id used,
when the type of this cache policy is NOT TYPE_USERSPECIFIEDpublic CacheBlock getCache(javax.servlet.http.HttpServletRequest req, java.lang.String specifiedName)
CacheBlock
) object) through
this cache policy.
This is the getCache
API for TYPE_USERSPECIFIED
cache policies.req
- the current HTTP servlet requestspecifiedName
- the user specified cache name used, when the type
of this cache policy is TYPE_USERSPECIFIED; it can be null, otherwisepublic java.util.Date getCurrentTime()
new java.util.Date()
public boolean isRecent(CacheBlock block)
reusableTimeStamp
and reusableDeltaTime
attribute, where reusableTimeStamp
takes precedence over
reusableDeltaTime
.
This method is called by the JSP tags to check whether the
cache block is recent enough to be reused. If it is not recent enough,
the JSP tags will execute the logic to generate a fresh copy of content
without replacing the exising copy. The concept is different from TTL
in expiration policies. Please refer the semantics of
reusableTimeStamp
and reusableDeltaTime
.
block
- the cache block to testpublic void putCache(java.lang.Object obj, javax.servlet.http.HttpServletRequest req, java.lang.String specifiedName, SectionId sectionId)
This is the comprehensive version of putCache
API.
The actual data object (passed into this API) that needs to be
stored into the cache. Caller does NOT need to create the
CacheBlock wrapper object to wrap the actual data object to
use this putCache
API. When getCache
is called, the actual data object will be returned
within a CacheBlock wrapper object, which contains other meta data
(e.g. creation time)
obj
- the actual data objectreq
- the current HTTP servlet requestspecifiedName
- the user specified cache name used, when the type
of this cache policy is TYPE_USERSPECIFIED; it can be null, otherwisesectionId
- the automatic-increment cach block id used, when the
type of this cache policy is NOT TYPE_USERSPECIFIED; it can be
null, otherwisepublic void putCache(java.lang.Object obj, javax.servlet.http.HttpServletRequest req, SectionId sectionId)
This is the putCache
API for NON-TYPE_USERSPECIFIED
cache policies.
The actual data object (passed into this API) that needs to be
stored into the cache. Caller does NOT need to create the
CacheBlock wrapper object to wrap the actual data object to
use this putCache
API. When getCache
is called, the actual data object will be returned
within a CacheBlock wrapper object, which contains other meta data
(e.g. creation time)
obj
- the actual data objectreq
- the current HTTP servlet requestsectionId
- the automatic-increment cach block id used, when the
type of this cache policy is NOT TYPE_USERSPECIFIED; it can be
null, otherwisepublic void putCache(java.lang.Object obj, javax.servlet.http.HttpServletRequest req, java.lang.String specifiedName)
This is the putCache
API for TYPE_USERSPECIFIED
cache policies.
The actual data object (passed into this API) that needs to be
stored into the cache. Caller does NOT need to create the
CacheBlock wrapper object to wrap the actual data object to
use this putCache
API. When getCache
is called, the actual data object will be returned
within a CacheBlock wrapper object, which contains other meta data
(e.g. creation time)
obj
- the actual data objectreq
- the current HTTP servlet requestspecifiedName
- the user specified cache name used, when the type
of this cache policy is TYPE_USERSPECIFIED; it can be null, otherwisepublic void invalidateCache(javax.servlet.http.HttpServletRequest req, java.lang.String specifiedName, SectionId sectionId)
This is the comprehensive version of invalidateCache
API.
req
- the current HTTP servlet requestspecifiedName
- the user specified cache name used, when the type
of this cache policy is TYPE_USERSPECIFIED; it can be null, otherwisesectionId
- the automatic-increment cach block id used, when the
type of this cache policy is NOT TYPE_USERSPECIFIED; it can be
null, otherwisepublic void invalidateCache(javax.servlet.http.HttpServletRequest req, java.lang.String specifiedName)
This is the invalidateCache
API for TYPE_USERSPECIFIED.
req
- the current HTTP servlet requestspecifiedName
- the user specified cache name used, when the type
of this cache policy is TYPE_USERSPECIFIED; it can be null, otherwisepublic void invalidateCache(javax.servlet.http.HttpServletRequest req, SectionId sectionId)
This is the invalidateCache
API for
NON-TYPE_USERSPECIFIED.
req
- the current HTTP servlet requestsectionId
- the automatic-increment cach block id used, when the
type of this cache policy is NOT TYPE_USERSPECIFIED; it can be
null, otherwisepublic static int autoInvalidateStrToLevelInt(java.lang.String s)
AUTO INVALIDATE LEVEL
String to the corresponding the AUTO INVALIDATE LEVEL
integer constant, which is used in invalidateCacheLike
method. e.g. from AUTO_INVALIDATE_APP_LEVEL_STR
to
AUTO_INVALIDATE_APP_LEVEL
.s
- the AUTO INVALIDATE LEVEL
string parameterAUTO INVALIDATE LEVEL integer constant
public void invalidateCacheLike(javax.servlet.http.HttpServletRequest req, java.lang.String specifiedName, int autoInvalidateLevel)
This is the comprehensive version of the
invalidateCacheLike
API.
req
- the current HTTP servlet request objectspecifiedName
- the user specified name used in
TYPE_USERSPECIFIED
cache policy; this parameter is ignored
when the cache policy is NOT TYPE_USERSPECIFIED
;
this parameter may contain some embedded wildcard "*";
however, most of the cache repositories do not support embedded wildcard
invalidation.autoInvalidateLevel
- the integer parameter that represents
invalidation level; this parameter is used only with cache policies
of auto types (i.e. NON-TYPE_USERSPECIFIED
); this parameter
is ignored, otherwisepublic void invalidateCacheLike(javax.servlet.http.HttpServletRequest req, java.lang.String specifiedName)
This is the invalidateCacheLike
API for
TYPE_USERSPECIFIED
cache policy.
req
- the current HTTP servlet request objectspecifiedName
- the user specified name used in
TYPE_USERSPECIFIED
cache policy; this parameter is ignored
when the cache policy is NOT TYPE_USERSPECIFIED
;
this parameter may contain some embedded wildcard "*";
however, most of the cache repositories do not support embedded wildcard
invalidation.public void invalidateCacheLike(javax.servlet.http.HttpServletRequest req, int autoInvalidateLevel)
This is the invalidateCacheLike
API for
NON-TYPE_USERSPECIFIED
cache policy.
req
- the current HTTP servlet request objectautoInvalidateLevel
- the integer parameter that represents
invalidation level; this parameter is used only with cache policies
of auto types (i.e. NON-TYPE_USERSPECIFIED
); this parameter
is ignored, otherwisepublic void invalidateCacheOtherPathLike(javax.servlet.http.HttpServletRequest req, java.lang.String otherPath, javax.servlet.http.Cookie[] newCookies, int autoInvalidateLevel)
req
- the current HTTP servlet request; the invalidate operation
will make use of the context path and the existing cookies, if new
cookes are suppliedotherPath
- the path of other URI of which developers want to
invalidate caches; the path includes the page name and an optional
parameter list; e.g., "/dir1/dir2/a.jsp" or "/dir3/b.jsp?p1=v1&p2=v2";
The new overriding page path and parameter will be used to invalidate
cachesnewCookies
- the array of new cookies; if developers pass in an array
of new cookies to this call, then the new set of cookies will be used
to invalidate caches (when the cache policy selects some cookies and
the invalidation level is down to the cookie level); if developers
do not pass an array of new cookies, the cookies of the current
request will be used to do invalidationautoInvalidateLevel
- the level of invalidation; if the caching
policy is NON-TYPE_USERSPECIFIED / automatic naming, an invalidation
level can be specified to set the level of the invalidation; they are
application, page, parameter and cookie; please refer to
AUTO_INVALIDATE_*
integer constants defined in this class.public void invalidateCacheOtherPathLike(javax.servlet.http.HttpServletRequest req, java.lang.String otherPath)
This shorthand version will always reuse the cookies of the current
HTTP request. And, the invalidation is set to the parameter level, if the
otherPath
contains an HTTP parameter list and a '?'
character (e.g. "/dir3/b.jsp?p1=v1&p2=v2"). Otherwise, the invalidation
is set to the page level.
req
- the current HTTP servlet request; the invalidate operation
will make use of the context path and the existing cookies, if new
cookes are suppliedotherPath
- the path of other URI of which developers want to
invalidate caches; the path includes the page name and an optional
parameter list; e.g., "/dir1/dir2/a.jsp" or "/dir3/b.jsp?p1=v1&p2=v2";
The new overriding page path and parameter will be used to invalidate
cachespublic void putAutoCacheForOtherPath(java.lang.Object obj, javax.servlet.http.HttpServletRequest req, java.lang.String otherPath, StringSectionId sectionId)
TYPE_USERSPECIFIED
, i.e. auto-type.obj
- the object being storedreq
- the current HttpServletRequestotherPath
- the path of the other page where the cache entry will
be attached tosectionId
- the string-based section id of which the cache entry
is stored underpublic void putAutoCacheForOtherPath(java.lang.Object obj, javax.servlet.http.HttpServletRequest req, java.lang.String otherPath, javax.servlet.http.Cookie[] newCookies, StringSectionId sectionId)
TYPE_USERSPECIFIED
, i.e. auto-type.obj
- the object being storedreq
- the current HttpServletRequestotherPath
- the path of the other page where the cache entry will
be attached tonewCookies
- the array of new cookies; if developers pass in an array
of new cookies to this call, then the new set of
cookies will be used to store the cache; otherwise,
the cookies of the current request will be usedsectionId
- the string-based section id of which the cache entry
is stored underpublic CacheBlock getAutoCacheForOtherPath(javax.servlet.http.HttpServletRequest req, java.lang.String otherPath, StringSectionId sectionId)
TYPE_USERSPECIFIED
, i.e. auto-type.obj
- the object being storedreq
- the current HttpServletRequestotherPath
- the path of the other page where the cache entry will
be attached tosectionId
- the string-based section id of which the cache entry
is stored underpublic CacheBlock getAutoCacheForOtherPath(javax.servlet.http.HttpServletRequest req, java.lang.String otherPath, javax.servlet.http.Cookie[] newCookies, StringSectionId sectionId)
TYPE_USERSPECIFIED
, i.e. auto-type.obj
- the object being storedreq
- the current HttpServletRequestotherPath
- the path of the other page where the cache entry will
be attached tonewCookies
- the array of new cookies; if developers pass in an array
of new cookies to this call, then the new set of
cookies will be used to store the cache; otherwise,
the cookies of the current request will be usedsectionId
- the string-based section id of which the cache entry
is stored underpublic void markupBegin(javax.servlet.ServletContext sc, javax.servlet.http.HttpServletRequest req, java.io.Writer out, java.lang.String specifiedName, SectionId sectionId)
sc
- the current servletcontextreq
- the current HTTP servlet requestout
- the current output writerspecifiedName
- the user specified cache name used, when the type
of this cache policy is TYPE_USERSPECIFIED; it can be null, otherwisesectionId
- the automatic-increment cach block id used, when the
type of this cache policy is NOT TYPE_USERSPECIFIED; it can be
null, otherwisepublic void markupEnd(javax.servlet.ServletContext sc, javax.servlet.http.HttpServletRequest req, java.io.Writer out, java.lang.String specifiedName, SectionId sectionId)
sc
- the current servletcontextreq
- the current HTTP servlet requestout
- the current output writerspecifiedName
- the user specified cache name used, when the type
of this cache policy is TYPE_USERSPECIFIED; it can be null, otherwisesectionId
- the automatic-increment cach block id used, when the
type of this cache policy is NOT TYPE_USERSPECIFIED; it can be
null, otherwise
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |