public class InMemoryStore extends Object implements KVStore
| Constructor and Description |
|---|
InMemoryStore() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
long |
count(Class<?> type)
Returns the number of items of the given type currently in the store.
|
long |
count(Class<?> type,
String index,
Object indexedValue)
Returns the number of items of the given type which match the given indexed value.
|
void |
delete(Class<?> type,
Object naturalKey)
Removes an object and all data related to it, like index entries, from the store.
|
<T> T |
getMetadata(Class<T> klass)
Returns app-specific metadata from the store, or null if it's not currently set.
|
<T> T |
read(Class<T> klass,
Object naturalKey)
Read a specific instance of an object.
|
void |
setMetadata(Object value)
Writes the given value in the store metadata key.
|
<T> KVStoreView<T> |
view(Class<T> type)
Returns a configurable view for iterating over entities of the given type.
|
void |
write(Object value)
Writes the given object to the store, including indexed fields.
|
public <T> T getMetadata(Class<T> klass)
KVStoreThe metadata type is application-specific. This is a convenience method so that applications don't need to define their own keys for this information.
getMetadata in interface KVStorepublic void setMetadata(Object value)
KVStoresetMetadata in interface KVStorepublic long count(Class<?> type)
KVStorepublic long count(Class<?> type, String index, Object indexedValue) throws Exception
KVStorepublic <T> T read(Class<T> klass, Object naturalKey)
KVStorepublic void write(Object value) throws Exception
KVStoreWrites may be slower when the object already exists in the store, since it will involve updating existing indices.
public void delete(Class<?> type, Object naturalKey)
KVStorepublic <T> KVStoreView<T> view(Class<T> type)
KVStorepublic void close()
close in interface Closeableclose in interface AutoCloseableCopyright © 2020. All rights reserved.