Package com.atlassian.bamboo.util
Class CallableResultCache<T>
java.lang.Object
com.atlassian.bamboo.util.CallableResultCache<T>
- Type Parameters:
T
-
Caches results of supplied callables.
Since 10.0, this class is internal and should not be used by plugins due to its dependency on guava cache library.
If really needed, plugin will need to bundle its own guava.
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> CallableResultCache<T>
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.executes a callable if no fresh result is cached, throws an checked exception SeeLoadingCache.getUnchecked(Object)
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 Details
-
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
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
-