Class CacheAwareness

java.lang.Object
com.atlassian.bamboo.util.CacheAwareness

@PublicApi public final class CacheAwareness extends Object
  • Field Details

  • Method Details

    • 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, E1, E3
      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
      E1 extends Exception
      E3 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, E1, E3
      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
      E1 extends Exception
      E3 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, E1, E3
      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
      E1 extends Exception
      E3 extends Exception
    • getDisabledCachesTimestamp

      public static Pair<Iterable<CacheAwareness.CacheInfo>,Long> getDisabledCachesTimestamp()