Package com.atlassian.bamboo.util
Class CacheAwareness
- java.lang.Object
-
- com.atlassian.bamboo.util.CacheAwareness
-
@PublicApi public final class CacheAwareness extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CacheAwareness.CacheInfo
-
Field Summary
Fields Modifier and Type Field Description static CacheAwareness.CacheInfo
ANY
static CacheAwareness.CacheInfo
BRANCH_DETECTION
static CacheAwareness.CacheInfo
CHANGE_DETECTION
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CacheAwareness.CacheInfo
cacheInfo(String cachedDataType)
static Pair<Iterable<CacheAwareness.CacheInfo>,Long>
getDisabledCachesTimestamp()
static <V,E1 extends Exception,E2 extends Exception,E3 extends Exception>
VwithValuesOlderThanTimestampReloaded(BambooCallables.ThrowingX<V,E1,E2,E3> callable, long timestamp, @Nullable CacheAwareness.CacheInfo... disabledCaches)
Executes the supplied runnable with the listed caches invalidated, values reloaded if value was previously cached before the timestampstatic <E1 extends Exception,E2 extends Exception,E3 extends Exception>
voidwithValuesOlderThanTimestampReloaded(BambooRunnables.ThrowingX<E1,E2,E3> runnable, long timestamp, @Nullable CacheAwareness.CacheInfo... disabledCached)
Executes the supplied runnable with the listed caches invalidated, values reloaded if value was previously cached before the timestampstatic <E1 extends Exception,E2 extends Exception,E3 extends Exception>
voidwithValuesOlderThanTimestampReloaded(BambooRunnables.ThrowingX<E1,E2,E3> runnable, long timestamp, Iterable<CacheAwareness.CacheInfo> disabledCaches)
Executes the supplied runnable with the listed caches invalidated, values reloaded if value was previously cached before the timestamp
-
-
-
Field Detail
-
CHANGE_DETECTION
public static final CacheAwareness.CacheInfo CHANGE_DETECTION
-
BRANCH_DETECTION
public static final CacheAwareness.CacheInfo BRANCH_DETECTION
-
ANY
public static final CacheAwareness.CacheInfo ANY
-
-
Method Detail
-
cacheInfo
public static CacheAwareness.CacheInfo cacheInfo(String cachedDataType)
-
withValuesOlderThanTimestampReloaded
public static <E1 extends Exception,E2 extends Exception,E3 extends Exception> void withValuesOlderThanTimestampReloaded(BambooRunnables.ThrowingX<E1,E2,E3> runnable, long timestamp, @Nullable @Nullable CacheAwareness.CacheInfo... disabledCached) throws E2 extends Exception, E1 extends Exception, E3 extends Exception
Executes the supplied runnable with the listed caches invalidated, values reloaded if value was previously cached before the timestamp- Parameters:
timestamp
- denotes the time of the request, typically System.currentTimeMilis().
If the value in cache was loaded AFTER this timestamp, the cache will NOT be reloaded.
If the value in cache was created BEFORE the timestamp, for disabled CacheInfos we reload the value.
If you want the cached values to be always reloaded and know what you are doing, use Long.MAX_VALUE for timestamp.disabledCaches
- caches to be affected within the runnable- Throws:
E2 extends Exception
-
withValuesOlderThanTimestampReloaded
public static <V,E1 extends Exception,E2 extends Exception,E3 extends Exception> V withValuesOlderThanTimestampReloaded(BambooCallables.ThrowingX<V,E1,E2,E3> callable, long timestamp, @Nullable @Nullable CacheAwareness.CacheInfo... disabledCaches) throws E2 extends Exception, E1 extends Exception, E3 extends Exception
Executes the supplied runnable with the listed caches invalidated, values reloaded if value was previously cached before the timestamp- Parameters:
timestamp
- denotes the time of the request, typically System.currentTimeMilis().
If the value in cache was loaded AFTER this timestamp, the cache will NOT be reloaded.
If the value in cache was created BEFORE the timestamp, for disabled CacheInfos we reload the value.
If you want the cached values to be always reloaded and know what you are doing, use Long.MAX_VALUE for timestamp.disabledCaches
- caches to be affected within the runnable- Throws:
E2 extends Exception
-
withValuesOlderThanTimestampReloaded
public static <E1 extends Exception,E2 extends Exception,E3 extends Exception> void withValuesOlderThanTimestampReloaded(BambooRunnables.ThrowingX<E1,E2,E3> runnable, long timestamp, Iterable<CacheAwareness.CacheInfo> disabledCaches) throws E2 extends Exception, E1 extends Exception, E3 extends Exception
Executes the supplied runnable with the listed caches invalidated, values reloaded if value was previously cached before the timestamp- Parameters:
timestamp
- denotes the time of the request, typically System.currentTimeMilis().
If the value in cache was loaded AFTER this timestamp, the cache will NOT be reloaded.
If the value in cache was created BEFORE the timestamp, for disabled CacheInfos we reload the value.
If you want the cached values to be always reloaded and know what you are doing, use Long.MAX_VALUE for timestamp.disabledCaches
- caches to be affected within the runnable- Throws:
E2 extends Exception
-
getDisabledCachesTimestamp
public static Pair<Iterable<CacheAwareness.CacheInfo>,Long> getDisabledCachesTimestamp()
-
-