@PublicApi
public interface CachedReference<V>
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(CachedReferenceListener<V> listener,
boolean includeValues)
Deprecated.
since 2.9 may not be supported in all implementations
|
V |
get()
Gets a value from the cache.
|
Optional<V> |
getIfPresent()
Checks if there is currently a value in the cache, and if so returns it.
|
boolean |
isPresent()
Checks if there is currently a value in the cache.
|
void |
removeListener(CachedReferenceListener<V> listener)
Deprecated.
since 2.9 may not be supported in all implementations
|
void |
reset()
Resets (clears/invalidates) this reference.
|
void reset()
boolean isPresent()
Note that cache entries could expire at any time, meaning that even after this method returns true, the reference
may still have to be reinitialized on the next call to get().
get() would return a reference without invoking the underlying supplier.@Nonnull Optional<V> getIfPresent()
Note that cache entries could expire at any time, meaning that even if this method returns a value, the reference
may still have to be reinitialized on the next call to get().
get() would return a reference without invoking the underyling supplier,
otherwise empty.@Deprecated void addListener(@Nonnull CachedReferenceListener<V> listener, boolean includeValues)
CachedReferenceListenerlistener - the listenerincludeValues - if the events sent to this listener will include old/new value. This can be used in cases
when the cost of finding these values is big (network sync) but the listener is not interested in the concrete
values for events its getting. The support for this parameter is optional and implementation dependentUnsupportedOperationException - if not supported@Deprecated void removeListener(@Nonnull CachedReferenceListener<V> listener)
CachedReferenceListenerlistener - the listenerUnsupportedOperationException - if not supportedCopyright © 2023 Atlassian. All rights reserved.