Class CacheStrategies


  • @ProviderType
    public final class CacheStrategies
    extends Object
    Default implementations of different cache strategies.
    • Method Detail

      • timeToLive

        public static CacheStrategy timeToLive​(int duration,
                                               TimeUnit unit)
        Invalidate item after a fixed time-to-live interval, using the same duration as storage time and revalidation-interval
        Parameters:
        duration - Time-to-live duration
        unit - Time unit
        Returns:
        Cache strategy
      • timeToIdle

        public static CacheStrategy timeToIdle​(int duration,
                                               TimeUnit unit)
        Invalidate item after a time-to-idle interval: The content is considered immutable, and storage time will be extended to specified value on each get operation on this item, so it is kept in cache as long as it is requested
        Parameters:
        duration - Time-to-idle duration
        unit - Time unit
        Returns:
        Cache strategy
      • nonTransientAndTimeToIdle

        public static CacheStrategy nonTransientAndTimeToIdle​(int duration,
                                                              TimeUnit unit)
        Invalidate item after a time-to-idle interval: The content is considered immutable, and storage time will be extended to specified value on each get operation on this item, so it is kept in cache as long as it is requested. Cache operations should be ignored by transient adapters and passed to the persistent adapters only.
        Parameters:
        duration - Time-to-idle duration
        unit - Time unit
        Returns:
        Cache strategy
      • temporary

        public static CacheStrategy temporary​(int duration,
                                              TimeUnit unit)
        Stores items only in the local, non-persistent CacheAdapter for the given maximum duration.
        Parameters:
        duration - maximum Time-to-live
        unit - Time unit
        Returns:
        Cache strategy
      • noCache

        public static CacheStrategy noCache()
        No caching. Can be used to disable caching in a JsonPipeline that already has some Cachepoints set.
        Returns:
        Cache strategy