Interface HttpCacheHandlingRule
- All Known Implementing Classes:
AbstractHttpCacheHandlingRule
public interface HttpCacheHandlingRule
Rules which impacts the behavior of http cache. Concrete implementation of this interface provides developers hooks
to supply custom behavior for key events in http cache.
Each method represents a hook to the http cache event.In case if a method is not applicable for a custom rule, make it return true indicating the cache engine to continue processing the next rule.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanonCacheDeliver(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, HttpCacheConfig cacheConfig, CacheContent cacheContent) Hook to supply custom behavior onHttpCacheEnginedelivering cache content after being read from cache store.booleanonCacheInvalidate(String path) Hook to supply custom behavior onHttpCacheEngineinvalidating cache for the changes in the given JCR repository path.booleanonRequestReceive(org.apache.sling.api.SlingHttpServletRequest request) Hook to supply custom behavior onHttpCacheEnginereceiving the request.booleanonResponseCache(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, HttpCacheConfig cacheConfig, CacheContent cacheContent) Hook to supply custom behavior onHttpCacheEngineabout to cache a response.
-
Method Details
-
onRequestReceive
boolean onRequestReceive(org.apache.sling.api.SlingHttpServletRequest request) Hook to supply custom behavior onHttpCacheEnginereceiving the request.- Parameters:
request-- Returns:
- True represents success and cache handling rules will be continued. False represents failure with cache handling rules being stopped and fallback action will be taken.
-
onResponseCache
boolean onResponseCache(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, HttpCacheConfig cacheConfig, CacheContent cacheContent) Hook to supply custom behavior onHttpCacheEngineabout to cache a response.- Parameters:
request-response-cacheConfig-cacheContent- Object carring data to be cached.- Returns:
- True represents success and cache handling rules will be continued. False represents failure with cache handling rules being stopped and fallback action will be taken.
-
onCacheDeliver
boolean onCacheDeliver(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, HttpCacheConfig cacheConfig, CacheContent cacheContent) Hook to supply custom behavior onHttpCacheEnginedelivering cache content after being read from cache store.- Parameters:
request-response-cacheConfig-cacheContent- Object carrying data to be delivered.- Returns:
- True represents success and cache handling rules will be continued. False represents failure with cache handling rules being stopped and fallback action will be taken.
-
onCacheInvalidate
Hook to supply custom behavior onHttpCacheEngineinvalidating cache for the changes in the given JCR repository path.- Parameters:
path- JCR repository path- Returns:
- True represents success and cache handling rules will be continued. False represents failure with cache handling rules being stopped and fallback action will be taken.
-