| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
NAMESPACE_INDEX
Deprecated.
|
| Constructor and Description |
|---|
Cache() |
Cache(java.lang.String indexName,
java.util.function.Function<ApiType,java.util.List<java.lang.String>> indexFunc,
java.util.function.Function<ApiType,java.lang.String> keyFunc)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(ApiType obj)
Add objects.
|
void |
addIndexers(java.util.Map<java.lang.String,java.util.function.Function<ApiType,java.util.List<java.lang.String>>> newIndexers)
Add additional indexers to the cache.
|
void |
addIndexFunc(java.lang.String indexName,
java.util.function.Function<ApiType,java.util.List<java.lang.String>> indexFunc)
Add index func.
|
java.util.List<ApiType> |
byIndex(java.lang.String indexName,
java.lang.String indexKey)
By index list.
|
void |
delete(ApiType obj)
Delete the object.
|
static <ApiType> java.lang.String |
deletionHandlingMetaNamespaceKeyFunc(ApiType object)
Deprecated.
|
ApiType |
get(ApiType obj)
Get object t.
|
ApiType |
getByKey(java.lang.String key)
Gets get by key.
|
java.util.Map<java.lang.String,java.util.function.Function<ApiType,java.util.List<java.lang.String>>> |
getIndexers()
Return the indexers registered with the cache.
|
java.util.function.Function<ApiType,java.lang.String> |
getKeyFunc() |
java.util.List<ApiType> |
index(java.lang.String indexName,
java.lang.Object obj)
Get objects .
|
java.util.List<java.lang.String> |
indexKeys(java.lang.String indexName,
java.lang.String indexKey)
Index keys list.
|
java.util.List<ApiType> |
list()
List all objects in the cache.
|
java.util.List<java.lang.String> |
listKeys()
List keys.
|
static java.util.List<java.lang.String> |
metaNamespaceIndexFunc(java.lang.Object obj)
Deprecated.
|
static java.lang.String |
metaNamespaceKeyFunc(java.lang.Object obj)
Deprecated.
|
void |
replace(java.util.List<ApiType> list,
java.lang.String resourceVersion)
Replace the content in the cache completely.
|
void |
resync()
Resync.
|
void |
setKeyFunc(java.util.function.Function<ApiType,java.lang.String> keyFunc) |
void |
update(ApiType obj)
Update the object.
|
void |
updateIndices(ApiType oldObj,
ApiType newObj,
java.lang.String key)
updateIndices modifies the objects location in the managed indexes, if this is an update, you
must provide an oldObj.
|
@Deprecated public static final java.lang.String NAMESPACE_INDEX
NAMESPACE_INDEX is the default index function for caching objects
public Cache()
public Cache(java.lang.String indexName,
java.util.function.Function<ApiType,java.util.List<java.lang.String>> indexFunc,
java.util.function.Function<ApiType,java.lang.String> keyFunc)
indexName - the index name, an unique name representing the indexindexFunc - the index func by which we map multiple object to an index for queryingkeyFunc - the key func by which we map one object to an unique key for storingpublic void add(ApiType obj)
public void update(ApiType obj)
public void delete(ApiType obj)
public void replace(java.util.List<ApiType> list, java.lang.String resourceVersion)
public java.util.List<java.lang.String> listKeys()
public java.util.List<ApiType> list()
public ApiType getByKey(java.lang.String key)
public java.util.List<ApiType> index(java.lang.String indexName, java.lang.Object obj)
public java.util.List<java.lang.String> indexKeys(java.lang.String indexName,
java.lang.String indexKey)
public java.util.List<ApiType> byIndex(java.lang.String indexName, java.lang.String indexKey)
public java.util.Map<java.lang.String,java.util.function.Function<ApiType,java.util.List<java.lang.String>>> getIndexers()
getIndexers in interface Indexer<ApiType>public void addIndexers(java.util.Map<java.lang.String,java.util.function.Function<ApiType,java.util.List<java.lang.String>>> newIndexers)
addIndexers in interface Indexer<ApiType>newIndexers - indexers to addpublic void updateIndices(ApiType oldObj, ApiType newObj, java.lang.String key)
Note: updateIndices must be called from a function that already has a lock on the cache.
oldObj - the old objnewObj - the new objkey - the keypublic void addIndexFunc(java.lang.String indexName,
java.util.function.Function<ApiType,java.util.List<java.lang.String>> indexFunc)
indexName - the index nameindexFunc - the index funcpublic java.util.function.Function<ApiType,java.lang.String> getKeyFunc()
public void setKeyFunc(java.util.function.Function<ApiType,java.lang.String> keyFunc)
@Deprecated public static <ApiType> java.lang.String deletionHandlingMetaNamespaceKeyFunc(ApiType object)
deletionHandlingMetaNamespaceKeyFunc checks for DeletedFinalStateUnknown objects before calling metaNamespaceKeyFunc.
ApiType - the type parameterobject - specific object@Deprecated public static java.lang.String metaNamespaceKeyFunc(java.lang.Object obj)
MetaNamespaceKeyFunc is a convenient default KeyFunc which knows how to make keys for API
objects which implement HasMetadata Interface. The key uses the format
obj - specific object@Deprecated public static java.util.List<java.lang.String> metaNamespaceIndexFunc(java.lang.Object obj)
metaNamespaceIndexFunc is a default index function that indexes based on an object's namespace.
obj - specific objectCopyright © 2020. All rights reserved.