public class PrefixMappedItemCache
extends java.lang.Object
GoogleCloudStorageItemInfo that maintains indexes based on
the item's bucket and object name. In addition to caching StorageResourceId to item
mappings, it provides options for storing groups of items under similar bucket and object name
prefixes.| Modifier and Type | Class and Description |
|---|---|
static class |
PrefixMappedItemCache.Config
Container for various cache-configuration parameters used by a
PrefixMappedItemCache
when managing expiration/retention policies, etc. |
| Constructor and Description |
|---|
PrefixMappedItemCache(PrefixMappedItemCache.Config config)
Creates a new
PrefixMappedItemCache. |
| Modifier and Type | Method and Description |
|---|---|
GoogleCloudStorageItemInfo |
getItem(StorageResourceId id)
Gets the cached item associated with the given resource id.
|
java.util.List<GoogleCloudStorageItemInfo> |
getList(java.lang.String bucket,
java.lang.String objectNamePrefix)
Gets the cached list associated with the given bucket and object name prefix.
|
void |
invalidateAll()
Invalidates all entries in the cache.
|
void |
invalidateBucket(java.lang.String bucket)
Invalidates all cached items and lists associated with the given bucket.
|
GoogleCloudStorageItemInfo |
putItem(GoogleCloudStorageItemInfo item)
Inserts an item into the cache.
|
void |
putList(java.lang.String bucket,
java.lang.String objectNamePrefix,
java.util.List<GoogleCloudStorageItemInfo> items)
Inserts a list entry and the given items into the cache.
|
GoogleCloudStorageItemInfo |
removeItem(StorageResourceId id)
Removes the item from the cache.
|
public PrefixMappedItemCache(PrefixMappedItemCache.Config config)
PrefixMappedItemCache.config - the configuration parameters to initialize the cache with. The configuration
parameters are copied during construction, future modifications to the configuration will
not be reflected in the cache.public GoogleCloudStorageItemInfo getItem(StorageResourceId id)
id - the resource id of the item to get.public java.util.List<GoogleCloudStorageItemInfo> getList(java.lang.String bucket, @Nullable java.lang.String objectNamePrefix)
bucket - the bucket where the entries are being retrieved from.objectNamePrefix - the object name prefix to match against. If this is empty string or
null, it will match everything in the bucket.public GoogleCloudStorageItemInfo putItem(GoogleCloudStorageItemInfo item)
item - the item to insert. The item must have a valid resource id.public void putList(java.lang.String bucket,
@Nullable
java.lang.String objectNamePrefix,
java.util.List<GoogleCloudStorageItemInfo> items)
bucket - the bucket to index the items by.objectNamePrefix - the object name prefix to index the items by. If this is null, it will
be converted to empty string.items - the list of items to insert.public GoogleCloudStorageItemInfo removeItem(StorageResourceId id)
id - the resource id of the item to remove.public void invalidateBucket(java.lang.String bucket)
bucket - the bucket to invalidate. This must not be null.public void invalidateAll()
Copyright © 2019. All rights reserved.