Interface CacheKey

All Superinterfaces:
Serializable
All Known Implementing Classes:
CombinedCacheKey, GroupCacheKey, KeyValueCacheKey, RequestPathCacheKey, ResourcePathCacheKey

public interface CacheKey extends Serializable
Generic CacheKey interface that allows multiple implementations of CacheKey's via CacheKeyFactories. All CacheKeys are scoped to being get off the Request object. Implementations are expected to override hashCode(), equals(Object), toString() methods.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    The equals method used to match up request-derived cache keys with keys in the httpcache.
    default long
    Gets the expiry time for the cache entry access / read.
    default long
    Gets the expiry time for the cache entry creation.
    default long
    Gets the expiry time for the cache entry updated.
    Gets the Hierarchy Resource Path (the resourcePath above jcr:content).
    Get URI.
    int
    The hashCode for the cache key.
    boolean
    Determines if the @{param cacheKey} will invalidate this cache key entry.
    The useful string representation of this cache key.
  • Method Details

    • getUri

      String getUri()
      Get URI.
      Returns:
      the universal resource id. This can be a RequestURI or a Resource path based on the context of the key.
    • getHierarchyResourcePath

      String getHierarchyResourcePath()
      Gets the Hierarchy Resource Path (the resourcePath above jcr:content). This is used for invalidations.
      Returns:
      the hierarchy resource path
    • getExpiryForCreation

      default long getExpiryForCreation()
      Gets the expiry time for the cache entry creation. If set, it will override the default TTL for entries to expire on cache creation. Value is in miliseconds.
      Returns:
      the expiry time
    • 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
    • isInvalidatedBy

      boolean isInvalidatedBy(CacheKey cacheKey)
      Determines if the @{param cacheKey} will invalidate this cache key entry.
      Parameters:
      cacheKey -
      Returns:
      true if is invalidated by, otherwise false
    • hashCode

      int hashCode()
      The hashCode for the cache key.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code.
    • toString

      String toString()
      The useful string representation of this cache key. This should be generally unique as it drives display in the mbean.
      Overrides:
      toString in class Object
      Returns:
      the string representing the cache key for human consumption.
    • equals

      boolean equals(Object o)
      The equals method used to match up request-derived cache keys with keys in the httpcache.
      Overrides:
      equals in class Object
      Parameters:
      o - the object to evaluate this against.
      Returns:
      true if the objects represent the same cache item, false otherwise.