Interface PageCacheKey

All Superinterfaces:
Serializable

public interface PageCacheKey extends Serializable
A PageCacheKey represents a key that can be used to qualify/categorize some request. Different Valves can contribute to this PageCacheKey through setAttribute(java.lang.String, java.io.Serializable).
  • Method Details

    • setAttribute

      void setAttribute(String subKey, Serializable keyFragment) throws IllegalStateException

      All the combined attributes will make up the final PageCacheKey. Note that the ORDER in which the attributes are set DO influence the final created cachekey. Make sure that your added keyFragment object have a decentObject.hashCode() and Object.equals(Object) implementation that is also efficient as it will be used when storing objects in a cache with key PageCacheKey.

      The subKey can best be prefixed by namespacing (FQN of class calling the setAttribute) to avoid collisions. For example

           
                PageCacheKey#setAttribute(MyValve.class.getName() + ".ip", ip-address);
           
           

      Parameters:
      subKey - the key to which the fragment belongs, not allowed to be null
      keyFragment - the fragment for the subKey, not allowed to be null
      Throws:
      IllegalStateException - is this PageCacheKey has been sealed via seal()
    • seal

      void seal()
      After seal() is invoked, a call to setAttribute(String, Serializable) will result in an IllegalStateException