Interface HttpCacheConfig


@ProviderType public interface HttpCacheConfig
Configuration for Http cache. Multiple configs can be supplied. Request uri, authentication details, cache store details and invalidation JCR path details are captured through configs. Developer hook supplied for extension of cache config via HttpCacheConfigExtension
  • Method Details

    • getCacheStoreName

      String getCacheStoreName()
      Name of the configured cache store.
      Returns:
    • getAuthenticationRequirement

      String getAuthenticationRequirement()
      Get the authentication requirement for request set for this config.
      Returns:
      Uses the constants defined in AuthenticationStatusConfigConstants
    • getRequestUriPatterns

      List<Pattern> getRequestUriPatterns()
      Get the configured list of whitelisted request URIs.
      Returns:
    • getBlacklistedRequestUriPatterns

      List<Pattern> getBlacklistedRequestUriPatterns()
      Get the configured list of blacklisted request URIs.
      Returns:
    • getJCRInvalidationPathPatterns

      List<Pattern> getJCRInvalidationPathPatterns()
      Get the configured list of JCR paths that could unvalidate this config.
      Returns:
    • getExcludedResponseHeaderPatterns

      default List<Pattern> getExcludedResponseHeaderPatterns()
      Get a list of headers (as regex pattern) that should NOT be put in the cached response, to be served to the output.
      Returns:
    • getExcludedCookieKeys

      default List<String> getExcludedCookieKeys()
      Get a list of excluded cookie keys (simple string) of cookies that should NOT be put in the cached response, to be served to the output. This is useful for example with systems that put a login cookie in each response.
      Returns:
    • accepts

      boolean accepts(org.apache.sling.api.SlingHttpServletRequest request) throws HttpCacheRepositoryAccessException
      Determine if this cache config is applicable for the given request. Calls HttpCacheConfigExtension .accept() for providing share of control to the custom code.
      Parameters:
      request - the request
      Returns:
      true if the response should be cached, false if it should not be cached.
      Throws:
      HttpCacheRepositoryAccessException
    • isValid

      boolean isValid()
      Returns:
      true if this config is considered valid and processable by the HttpCacheEngine.
    • buildCacheKey

      CacheKey buildCacheKey(org.apache.sling.api.SlingHttpServletRequest request) throws HttpCacheKeyCreationException
      Creates the CacheKey object using the CacheKeyFactory associated with this HttpCacheConfig factory instance.
      Parameters:
      request - the request to create the CacheKey for
      Returns:
      the CacheKey
      Throws:
      HttpCacheKeyCreationException
    • buildCacheKey

      CacheKey buildCacheKey(String resourcePath) throws HttpCacheKeyCreationException
      Creates the CacheKey object using the CacheKeyFactory associated with this HttpCacheConfig factory instance.
      Parameters:
      resourcePath - the resourcePath associated with the Cache Key
      Returns:
      the CacheKey
      Throws:
      HttpCacheKeyCreationException
    • canInvalidate

      boolean canInvalidate(String path)
      Determines if a JCR path is a candidate for invalidating this cache.
      Parameters:
      path - the jcr path
      Returns:
      true if this config can be invalidated by a change to this path
    • knows

      boolean knows(CacheKey key) throws HttpCacheKeyCreationException
      Returns true if the key is generated using this cache config.
      Parameters:
      key -
      Returns:
      Throws:
      HttpCacheKeyCreationException
    • getOrder

      int getOrder()
      Gets the order the HttpCacheConfig should be executed in.
      Returns:
    • acceptsRule

      boolean acceptsRule(String servicePid)
      Check if the cache config accepts the service pid of the cache handling rule.
      Parameters:
      servicePid - Service pid of HttpCacheHandlingRule.
      Returns:
      True if it accepts.
    • getFilterScope

      HttpCacheConfig.FilterScope getFilterScope()
      Returns:
      the filter scope this HttpCacheConfig should involve itself in.
    • getExpiryOnCreate

      default long getExpiryOnCreate()
      Returns a custom expiry for this config in miliseconds. -1 means the entry will never expire itself. 0 means the expiry is not set, and the default expiry will be used. 1 or above is the expiry for entries produced by this config .
      Returns:
    • getExpiryForAccess

      default long getExpiryForAccess()
      Gets the expiry time for the cache entry access / read. If set, it will refresh the expiry time when an entry is read with given value. Value is in miliseconds.
      Returns:
      the expiry time
    • getExpiryForUpdate

      default long getExpiryForUpdate()
      Gets the expiry time for the cache entry updated. If set, it will refresh the expiry time when an entry is updated with given value. Value is in miliseconds.
      Returns:
      the expiry time