Package com.sun.appserv.web.cache
Interface CacheHelper
-
- All Known Implementing Classes:
DefaultCacheHelper
public interface CacheHelper
CacheHelper interface is an user-extensible interface to customize: a) the key generation b) whether to cache the response.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ATTR_CACHE_MAPPED_SERVLET_NAME
static String
ATTR_CACHE_MAPPED_URL_PATTERN
static int
TIMEOUT_VALUE_NOT_SET
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
destroy()
Stop the helper from active useString
getCacheKey(jakarta.servlet.http.HttpServletRequest request)
getCacheKey: generate the key to be used to cache this requestint
getTimeout(jakarta.servlet.http.HttpServletRequest request)
get timeout for the cached response.void
init(jakarta.servlet.ServletContext context, Map<String,String> props)
initialize the helperboolean
isCacheable(jakarta.servlet.http.HttpServletRequest request)
isCacheable: is the response to given request cachebale?boolean
isRefreshNeeded(jakarta.servlet.http.HttpServletRequest request)
isRefreshNeeded: is the response to given request be refreshed?
-
-
-
Field Detail
-
ATTR_CACHE_MAPPED_SERVLET_NAME
static final String ATTR_CACHE_MAPPED_SERVLET_NAME
- See Also:
- Constant Field Values
-
ATTR_CACHE_MAPPED_URL_PATTERN
static final String ATTR_CACHE_MAPPED_URL_PATTERN
- See Also:
- Constant Field Values
-
TIMEOUT_VALUE_NOT_SET
static final int TIMEOUT_VALUE_NOT_SET
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
void init(jakarta.servlet.ServletContext context, Map<String,String> props) throws Exception
initialize the helper- Parameters:
context
- the web application context this helper belongs to- Throws:
Exception
- if a startup error occurs
-
getCacheKey
String getCacheKey(jakarta.servlet.http.HttpServletRequest request)
getCacheKey: generate the key to be used to cache this request- Parameters:
request
- incomingHttpServletRequest
object- Returns:
- the generated key for this requested cacheable resource.
-
isCacheable
boolean isCacheable(jakarta.servlet.http.HttpServletRequest request)
isCacheable: is the response to given request cachebale?- Parameters:
request
- incomingHttpServletRequest
object- Returns:
true
if the response could be cached. orfalse
if the results of this request must not be cached.
-
isRefreshNeeded
boolean isRefreshNeeded(jakarta.servlet.http.HttpServletRequest request)
isRefreshNeeded: is the response to given request be refreshed?- Parameters:
request
- incomingHttpServletRequest
object- Returns:
true
if the response needs to be refreshed. or returnfalse
if the results of this request don't need to be refreshed.
-
getTimeout
int getTimeout(jakarta.servlet.http.HttpServletRequest request)
get timeout for the cached response.- Parameters:
request
- incomingHttpServletRequest
object- Returns:
- the timeout in seconds for the cached response; a return value of -1 means the response never expires and a value of -2 indicates helper cannot determine the timeout (container assigns default timeout)
-
-