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 Type
    Method
    Description
    boolean
    onCacheDeliver(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, HttpCacheConfig cacheConfig, CacheContent cacheContent)
    Hook to supply custom behavior on HttpCacheEngine delivering cache content after being read from cache store.
    boolean
    Hook to supply custom behavior on HttpCacheEngine invalidating cache for the changes in the given JCR repository path.
    boolean
    onRequestReceive(org.apache.sling.api.SlingHttpServletRequest request)
    Hook to supply custom behavior on HttpCacheEngine receiving the request.
    boolean
    onResponseCache(org.apache.sling.api.SlingHttpServletRequest request, org.apache.sling.api.SlingHttpServletResponse response, HttpCacheConfig cacheConfig, CacheContent cacheContent)
    Hook to supply custom behavior on HttpCacheEngine about to cache a response.
  • Method Details

    • onRequestReceive

      boolean onRequestReceive(org.apache.sling.api.SlingHttpServletRequest request)
      Hook to supply custom behavior on HttpCacheEngine receiving 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 on HttpCacheEngine about 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 on HttpCacheEngine delivering 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

      boolean onCacheInvalidate(String path)
      Hook to supply custom behavior on HttpCacheEngine invalidating 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.