public interface CacheControl
CacheControl
interface represents cache settings
for a piece of markup. The settings are only valid for the current
request.Modifier and Type | Method and Description |
---|---|
String |
getETag()
Returns the ETag for the current response that is
used as validation tag, or
null
if no ETag is set on the response. |
int |
getExpirationTime()
Get
the currently set expiration time.
|
boolean |
isPublicScope()
Returns a boolean indicating whether the
caching scope is set to public for the current response.
|
void |
setETag(String token)
Sets an ETag for the current response that is
used as validation tag.
|
void |
setExpirationTime(int time)
Sets a new expiration time for the current response
in seconds.
|
void |
setPublicScope(boolean publicScope)
Sets the caching scope for the current response
to public with
true as
publicScope and to private with
false as publicScope . |
void |
setUseCachedContent(boolean useCachedContent)
Sets the indication whether the cached content
for the provided ETag at the request is still valid or not.
|
boolean |
useCachedContent()
Returns a boolean indicating whether the
cached content for the provided ETag at the request
can still be considerated valid.
|
int getExpirationTime()
expiration-cache
tag is returned; If
no default value is provided in the portlet deployment descriptor,
0 is returned.
This call returns the same value as the
getProperty(EXPIRATION_CACHE)
call.
void setExpirationTime(int time)
If the expiration value is set to 0, caching is disabled for this portlet; if the value is set to -1, the cache does not expire.
This call is equivalent to calling
setProperty(EXPIRATION_CACHE)
.
time
- expiration time in secondsboolean isPublicScope()
cache-scope
tag is returned,
or false
if no default is defined.
Public cache scope indicates that the cache entry can be shared across users. Non-public, or private cache scope indicates that the cache entry must not be shared across users.
This call is equivalent to calling
getProperty(CACHE_SCOPE).equals(PUBLIC_SCOPE)
.
void setPublicScope(boolean publicScope)
true
as
publicScope
and to private with
false
as publicScope
.
Public cache scope indicates that the cache entry can be shared across users. Non-public, or private cache scope indicates that the cache entry must not be shared across users.
This call is equivalent to calling
(publicScope ? setProperty(CACHE_SCOPE, PUBLIC_SCOPE |
setProperty(CACHE_SCOPE, PRIVATE_SCOPE)
.
publicScope
- indicating if the cache entry can be shared across usersString getETag()
null
if no ETag is set on the response.
This call is equivalent to calling
getProperty(ETAG)
.
null
if no ETag is set.void setETag(String token)
This call is equivalent to calling
setProperty(ETAG, token)
.
Setting the ETag to null
removes
the currently set ETag.
token
- the ETag tokenboolean useCachedContent()
false
.
This call is equivalent to calling
getProperty(USE_CACHED_CONTENT)
and getting a non-null
value back.
void setUseCachedContent(boolean useCachedContent)
true
no output should be rendered,
but a new expiration time should be set for the
markup with the given ETag .
This call is equivalent to calling
setProperty(USE_CACHED_CONTENT, "true")
.
useCachedContent
- boolean indication whether the
the cached content is still valid or notJava Portlet 3.0 API Specification. See the Copyright and License provided with this distribution. Use is subject to license terms.