Modifier and Type | Field and Description |
---|---|
static String |
NAMESPACE_INDEX |
Constructor and Description |
---|
Cache() |
Cache(String indexName,
Function<T,List<String>> indexFunc,
Function<T,String> keyFunc) |
Modifier and Type | Method and Description |
---|---|
void |
addIndexers(Map<String,Function<T,List<String>>> indexersNew)
Add additional indexers to the store.
|
void |
addIndexFunc(String indexName,
Function<T,List<String>> indexFunc)
Add index func.
|
List<T> |
byIndex(String indexName,
String indexKey)
By index list
|
T |
get(T obj)
Get object
|
T |
getByKey(String key)
Gets get by key.
|
Map<String,Function<T,List<String>>> |
getIndexers()
Returns the indexers registered with the cache.
|
String |
getKey(T obj)
Get the key for the given object
|
List<T> |
index(String indexName,
T obj)
Get objects
|
List<String> |
indexKeys(String indexName,
String indexKey)
Index keys list
|
List<T> |
list()
List all objects in the cache.
|
List<String> |
listKeys()
List keys
|
static List<String> |
metaNamespaceIndexFunc(Object obj)
It is a default index function that indexes based on an object's namespace
|
static String |
metaNamespaceKeyFunc(Object obj)
It's is a convenient default KeyFunc which know show to make keys for API
objects which implement HasMetadata interface.
|
static String |
namespaceKeyFunc(String objectNamespace,
String objectName)
Default index function that indexes based on an object's namespace and name.
|
T |
put(T obj)
Update the object.
|
T |
remove(T obj)
Delete the object.
|
Map<String,T> |
replace(List<T> list)
Replace the content in the cache completely.
|
void |
setIsRunning(BooleanSupplier isRunning) |
public static final String NAMESPACE_INDEX
public void setIsRunning(BooleanSupplier isRunning)
public Map<String,Function<T,List<String>>> getIndexers()
getIndexers
in interface Indexer<T>
public void addIndexers(Map<String,Function<T,List<String>>> indexersNew)
Indexer
addIndexers
in interface Indexer<T>
indexersNew
- indexers to addpublic Map<String,T> replace(List<T> list)
list
- list of objectspublic void addIndexFunc(String indexName, Function<T,List<String>> indexFunc)
indexName
- the index nameindexFunc
- the index funcpublic static String metaNamespaceKeyFunc(Object obj)
obj
- specific objectpublic static String namespaceKeyFunc(String objectNamespace, String objectName)
metaNamespaceKeyFunc(java.lang.Object)
Copyright © 2015–2020 Red Hat. All rights reserved.