Package com.sun.appserv.web.cache
Interface CacheHelper
-
- All Known Implementing Classes:
DefaultCacheHelper
public interface CacheHelperCacheHelper 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 StringATTR_CACHE_MAPPED_SERVLET_NAMEstatic StringATTR_CACHE_MAPPED_URL_PATTERNstatic intTIMEOUT_VALUE_NOT_SET
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voiddestroy()Stop the helper from active useStringgetCacheKey(jakarta.servlet.http.HttpServletRequest request)getCacheKey: generate the key to be used to cache this requestintgetTimeout(jakarta.servlet.http.HttpServletRequest request)get timeout for the cached response.voidinit(jakarta.servlet.ServletContext context, Map<String,String> props)initialize the helperbooleanisCacheable(jakarta.servlet.http.HttpServletRequest request)isCacheable: is the response to given request cachebale?booleanisRefreshNeeded(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 Exceptioninitialize 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- incomingHttpServletRequestobject- 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- incomingHttpServletRequestobject- Returns:
trueif the response could be cached. orfalseif 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- incomingHttpServletRequestobject- Returns:
trueif the response needs to be refreshed. or returnfalseif 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- incomingHttpServletRequestobject- 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)
-
-