Class CacheAwareness


  • @PublicApi
    public final class CacheAwareness
    extends Object
    • Method Detail

      • 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