public class InMemoryStore<V> extends BasePersistentStore<V>
| Constructor and Description |
|---|
InMemoryStore(int capacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
boolean |
contains(String key)
Checks if lookup key is present in store.
|
boolean |
contains(String key,
DataChangeVersion dataChangeVersion)
By default contains with version will behave the same way as without version.
|
void |
delete(String key)
Removes the value corresponding to the given key if exists, nothing happens otherwise.
|
V |
get(String key)
Returns the value for the given key if exists, null otherwise.
|
V |
get(String key,
DataChangeVersion dataChangeVersion)
By default get with version will behave the same way as without version.
|
PersistentStoreMode |
getMode()
Returns storage
mode of this store. |
Iterator<Map.Entry<String,V>> |
getRange(int skip,
int take)
Returns an iterator of desired number of entries offsetting by the skip value.
|
void |
put(String key,
V value)
Stores the (key, value) tuple in the store.
|
void |
put(String key,
V value,
DataChangeVersion dataChangeVersion)
By default put with version will behave the same way as without version.
|
boolean |
putIfAbsent(String key,
V value)
Stores the (key, value) tuple in the store only if it does not exists.
|
getAllpublic void delete(String key)
PersistentStorekey - lookup keypublic PersistentStoreMode getMode()
PersistentStoremode of this store.public boolean contains(String key)
PersistentStorekey - lookup keypublic boolean contains(String key, DataChangeVersion dataChangeVersion)
BasePersistentStorecontains in interface PersistentStore<V>contains in class BasePersistentStore<V>key - lookup keydataChangeVersion - version holderpublic V get(String key)
PersistentStorekey - lookup keypublic V get(String key, DataChangeVersion dataChangeVersion)
BasePersistentStoreget in interface PersistentStore<V>get in class BasePersistentStore<V>key - lookup keydataChangeVersion - version holderpublic void put(String key, V value)
PersistentStoremode.key - lookup keyvalue - value to storepublic void put(String key, V value, DataChangeVersion dataChangeVersion)
BasePersistentStoreput in interface PersistentStore<V>put in class BasePersistentStore<V>key - lookup keyvalue - value to storedataChangeVersion - version holderpublic boolean putIfAbsent(String key, V value)
PersistentStorekey - lookup keyvalue - value to storepublic Iterator<Map.Entry<String,V>> getRange(int skip, int take)
PersistentStoreskip - number of records to skip from beginningtake - max number of records to returnCopyright © 2017 The Apache Software Foundation. All rights reserved.