Package io.wcm.caravan.pipeline.cache
Class CacheStrategies
- java.lang.Object
-
- io.wcm.caravan.pipeline.cache.CacheStrategies
-
@ProviderType public final class CacheStrategies extends Object
Default implementations of different cache strategies.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CacheStrategy
noCache()
No caching.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.static CacheStrategy
temporary(int duration, TimeUnit unit)
Stores items only in the local, non-persistentCacheAdapter
for the given maximum duration.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 requestedstatic 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
-
-
-
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 durationunit
- 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 durationunit
- 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 durationunit
- Time unit- Returns:
- Cache strategy
-
temporary
public static CacheStrategy temporary(int duration, TimeUnit unit)
Stores items only in the local, non-persistentCacheAdapter
for the given maximum duration.- Parameters:
duration
- maximum Time-to-liveunit
- Time unit- Returns:
- Cache strategy
-
noCache
public static CacheStrategy noCache()
No caching. Can be used to disable caching in aJsonPipeline
that already has some Cachepoints set.- Returns:
- Cache strategy
-
-