Package com.atlassian.bamboo.util
Class CallableResultCache<T>
- java.lang.Object
-
- com.atlassian.bamboo.util.CallableResultCache<T>
-
- Type Parameters:
T
-
@PublicApi public class CallableResultCache<T> extends Object
Caches results of supplied callables.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CallableResultCache.CachedOperationId<T>
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <T> CallableResultCache<T>
build(@NotNull com.google.common.cache.CacheBuilder<Object,Object> builder)
Builds a simple callable result cache using the supplied builder.static <T> CallableResultCache<T>
build(@NotNull com.google.common.cache.CacheBuilder<Object,Object> builder, CacheAwareness.CacheInfo... cacheIds)
Builds a simple callable result cache using the supplied builder.static <T> CallableResultCache<T>
buildAlwaysInvalidating(@NotNull com.google.common.cache.CacheBuilder<Object,Object> builder, CacheAwareness.CacheInfo... cacheIds)
Builds a simple callable result cache using the supplied builder.T
call(@NotNull Callable<T> callable, Object... keys)
executes a callable if no fresh result is cached, throws an checked exception SeeLoadingCache.getUnchecked(Object)
T
callChecked(@NotNull Callable<T> callable, Object... keys)
executes a callable if no fresh result is cached, throws a checked exception SeeLoadingCache.get(Object)
com.google.common.cache.CacheStats
stats()
-
-
-
Method Detail
-
build
public static <T> CallableResultCache<T> build(@NotNull @NotNull com.google.common.cache.CacheBuilder<Object,Object> builder)
Builds a simple callable result cache using the supplied builder. The cache has no support for user-contaxt driven invalidation.
-
build
public static <T> CallableResultCache<T> build(@NotNull @NotNull com.google.common.cache.CacheBuilder<Object,Object> builder, CacheAwareness.CacheInfo... cacheIds)
Builds a simple callable result cache using the supplied builder. Supplied cacheIds will be used in user-context driven invalidation. seeCacheAwareness.withValuesOlderThanTimestampReloaded(BambooRunnables.ThrowingX, long, CacheAwareness.CacheInfo...)
-
buildAlwaysInvalidating
public static <T> CallableResultCache<T> buildAlwaysInvalidating(@NotNull @NotNull com.google.common.cache.CacheBuilder<Object,Object> builder, CacheAwareness.CacheInfo... cacheIds)
Builds a simple callable result cache using the supplied builder. The cache will be invalidated again when invalidate is called while cache load is taking place. Seebuild(com.google.common.cache.CacheBuilder, com.atlassian.bamboo.util.CacheAwareness.CacheInfo...)
,AlwaysInvalidatingCacheDecorator
-
stats
public com.google.common.cache.CacheStats stats()
- Returns:
- cache statistics
-
call
public T call(@NotNull @NotNull Callable<T> callable, Object... keys)
executes a callable if no fresh result is cached, throws an checked exception SeeLoadingCache.getUnchecked(Object)
-
callChecked
public T callChecked(@NotNull @NotNull Callable<T> callable, Object... keys) throws ExecutionException
executes a callable if no fresh result is cached, throws a checked exception SeeLoadingCache.get(Object)
- Throws:
ExecutionException
-
-