T - the typepublic class AbstractMetadataRegistry<T> extends Object implements MetadataRegistry<T>
MetadataRegistry using a LoadingCache.| Modifier and Type | Field and Description |
|---|---|
protected com.google.common.cache.LoadingCache<T,MetadataMap> |
cache |
| Constructor and Description |
|---|
AbstractMetadataRegistry() |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanup()
Performs cache maintenance to remove empty map instances and expired transient values.
|
Optional<MetadataMap> |
get(T id)
Gets a
MetadataMap for the given object, if one already exists and has
been cached in this registry. |
MetadataMap |
provide(T id)
Produces a
MetadataMap for the given object. |
void |
remove(T id)
Deletes the
MetadataMap and all contained MetadataKeys for
the given object. |
@Nonnull protected final com.google.common.cache.LoadingCache<T,MetadataMap> cache
@Nonnull public MetadataMap provide(@Nonnull T id)
MetadataRegistryMetadataMap for the given object.provide in interface MetadataRegistry<T>id - the object@Nonnull public Optional<MetadataMap> get(@Nonnull T id)
MetadataRegistryMetadataMap for the given object, if one already exists and has
been cached in this registry.get in interface MetadataRegistry<T>id - the objectpublic void remove(@Nonnull T id)
MetadataRegistryMetadataMap and all contained MetadataKeys for
the given object.remove in interface MetadataRegistry<T>id - the objectpublic void cleanup()
MetadataRegistrycleanup in interface MetadataRegistry<T>Copyright © 2022. All rights reserved.