Interface ContextHubCache


public interface ContextHubCache
  • Method Details

    • getCode

      Retrieves the code for the particular contexthub configuration and corresponding to the given codeType from the cache. The contexthub configuration, for which the code needs to be returned, is retrieved from the given request object.
      Parameters:
      request - The request object from which the contexthub configuration path is retrieved
      codeType - the type of code to return
      Returns:
      String containing the code if the code is present in the cache
      null if code is not found in the cache
    • getCodeMetadata

      Map getCodeMetadata(SlingHttpServletRequest request, ContextHubCache.CodeType codeType)
      Retrieves the metadata for the code stored in the cache - for the particular contexthub configuration and corresponding to the given codeType. The contexthub configuration, for which the metadata needs to be returned, is retrieved from the given request object.
      Parameters:
      request - The request object from which the contexthub configuration path is retrieved
      codeType - the type of code corresponding to which the metadata should be returned
      Returns:
      Map containing the metadata as key-value pairs if the code and its corresponding metadata is present in the cache
      The returned map would be empty if the code or its corresponding metadata is not found in the cache
    • cacheCode

      void cacheCode(SlingHttpServletRequest request, ContextHubCache.CodeType codeType, String code)
      Stores the supplied code in the cache. The code is mapped and stored for the particular contexthub configuration and corresponding to the given codeType. The contexthub configuration, corresponding to which the code needs to be stored, is retrieved from the given request object.
      Parameters:
      request - The request object from which the contexthub configuration path is retrieved
      codeType - The type of code corresponding to which the code needs to be stored.
      code - the code to store
    • setCodeMetadata

      void setCodeMetadata(SlingHttpServletRequest request, ContextHubCache.CodeType codeType, Map metadata)
      Stores the supplied metadata in the cache. The metadata is mapped and stored for the particular contexthub configuration and corresponding to the given codeType. The contexthub configuration, corresponding to which the metadata needs to be stored, is retrieved from the given request object.
      Parameters:
      request - The request object from which the contexthub configuration path is retrieved
      codeType - The type of code corresponding to which the metadata needs to stored
      metadata - The metadata to store