Class InvalidatableCacheLoader<K,​V>

  • All Implemented Interfaces:
    com.atlassian.cache.CacheLoader<K,​V>

    @Internal
    public final class InvalidatableCacheLoader<K,​V>
    extends Object
    implements com.atlassian.cache.CacheLoader<K,​V>
    CacheLoader that allows values to be invalidated during creation.

    This class is a workaround for https://jira.atlassian.com/browse/CACHE-106.

    Since:
    5.7
    • Method Detail

      • createLocal

        public static <K,​V> InvalidatableCacheLoader<K,​V> createLocal​(com.atlassian.cache.CacheLoader<K,​V> delegate)
        Creates a new InvalidatableCacheLoader that only invalidates values being created on the local JVM.
        Parameters:
        delegate - CacheLoader to use for creating the values
        Returns:
        InvalidatableCacheLoader that only invalidates values being created on the local JVM
      • load

        public @NonNull V load​(K key)
        Specified by:
        load in interface com.atlassian.cache.CacheLoader<K,​V>
      • invalidateAll

        public void invalidateAll()
        Invalidates all values that are in the process of being loaded and forces them to be loaded again immediately.