java.lang.Object
com.broadleafcommerce.common.extension.cache.api.CacheUtility

public final class CacheUtility extends Object
Utility class for working with several interactions between broadleaf and spring cache.
Author:
Jeff Fischer
  • Method Details

    • getKey

      public static org.springframework.cache.interceptor.SimpleKey getKey(com.fasterxml.jackson.databind.node.ObjectNode node)
      Generates a SimpleKey instance based on one or more key fragments. Primarily used during ContextKeyGen.generate(Object, Method, Object...) processing, but could also be used for programmatic CacheManager manipulation.
      Parameters:
      node - The identifying parts that should go into the key definition
      Returns:
      The completed key definition for spring cache
    • getKey

      public static org.springframework.cache.interceptor.SimpleKey getKey(@Nullable String prefix, com.fasterxml.jackson.databind.node.ObjectNode node)
      Generates a SimpleKey instance based on one or more key fragments. Primarily used during ContextKeyGen.generate(Object, Method, Object...) processing, but could also be used for programmatic CacheManager manipulation. This implementation includes a prefix in clear text in the key before the key generated from the node param.
      Parameters:
      prefix - A prefix for the key. Presumably helpful in identifying the cache member in another process.
      node - The identifying parts that should go into the key definition
      Returns:
      The completed key definition for spring cache
    • round

      public static Instant round(Instant input, TemporalField roundTo, int roundIncrement)
      Given an Instant, round the instant up to the nearest roundIncrement based on the roundTo type (e.g. hour, minute, second, etc...).
      Parameters:
      input - The instant in time to round
      roundTo - The aspect of the time to round (e.g. round to the nearest ceiling increment)
      roundIncrement - The quantity to use for rounding
      Returns:
      The rounded instant in time
    • now

      public static Instant now(TemporalIdentifier temporalIdentifier)
      Given a TemporalIdentifier instance, return the current instant in time (either now, or preview)
      Parameters:
      temporalIdentifier - The TemporalIdentifier instance that can generate the target time.
      Returns:
      The target time.
    • forListWith

      public static ImperativeListChainable forListWith(CacheStateManager cacheStateManager)
      Parameters:
      cacheStateManager - Supports interaction with CacheManager
      Returns:
      The chainable call.
    • forSingleWith

      public static SingleItemChainable forSingleWith(CacheStateManager cacheStateManager)
      Parameters:
      cacheStateManager - Supports interaction with CacheManager
      Returns:
      The chainable call.