public class MongoPersistentStore<V> extends BasePersistentStore<V>
Constructor and Description |
---|
MongoPersistentStore(PersistentStoreConfig<V> config,
com.mongodb.client.MongoCollection<org.bson.Document> collection) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
contains(String key)
Checks if lookup key is present in store.
|
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.
|
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.
|
boolean |
putIfAbsent(String key,
V value)
Stores the (key, value) tuple in the store only if it does not exists.
|
getAll
public MongoPersistentStore(PersistentStoreConfig<V> config, com.mongodb.client.MongoCollection<org.bson.Document> collection)
public PersistentStoreMode getMode()
Store
mode
of this store.public boolean contains(String key)
PersistentStore
key
- lookup keypublic V get(String key)
PersistentStore
key
- lookup keypublic void put(String key, V value)
PersistentStore
mode
.key
- lookup keyvalue
- value to storepublic boolean putIfAbsent(String key, V value)
Store
key
- lookup keyvalue
- value to storepublic void delete(String key)
Store
key
- lookup keypublic Iterator<Map.Entry<String,V>> getRange(int skip, int take)
Store
skip
- number of records to skip from beginningtake
- max number of records to returnpublic void close()
Copyright © 2021 The Apache Software Foundation. All rights reserved.