@ParametersAreNonnullByDefault public interface

SingleValueLocalCache

com.atlassian.jira.cache.SingleValueLocalCache<V>

Class Overview

Convenience class that allows to store a single value in an internal cache.

Summary

Constants
String KEY
Public Methods
@Nonnull V get()
Gets a cached value or creates new one (using the supplier) and puts it into the cache if value does not exist.
static <V> SingleValueLocalCache<V> of(LocalCacheOperations<String, V> cache, Supplier<V> supplier)
Creates single value cache wrapper over LocalCacheOperations.
void reset()
Removes a cached value from the cache if it is cached.

Constants

public static final String KEY

Constant Value: "cachedReferenceKey"

Public Methods

@Nonnull public V get ()

Gets a cached value or creates new one (using the supplier) and puts it into the cache if value does not exist.

Returns
  • cached value.

public static SingleValueLocalCache<V> of (LocalCacheOperations<String, V> cache, Supplier<V> supplier)

Creates single value cache wrapper over LocalCacheOperations.

Parameters
cache that would used as a backend. It should not be used directly by anything else.
supplier used to generate the value, if one does not exist already for the key. The supplier may not return null.
Returns

public void reset ()

Removes a cached value from the cache if it is cached.