Class CacheUtility


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

      • 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 programatic CacheManager manipulation.
        Parameters:
        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.