K
- type of the MapStore keyV
- type of the MapStore valuepublic interface MapStore<K,V> extends MapLoader<K,V>
IMap.put(key, value) normally stores the entry into JVM's memory. If the MapStore implementation is provided then Hazelcast will also call the MapStore implementation to store the entry into a user-defined storage, such as RDBMS or some other external storage system. It is completely up to the user how the key-value will be stored or deleted.
Same goes for IMap.remove(key).
Store implementation can be called synchronously (write-through) or asynchronously (write-behind) depending on the configuration.
Modifier and Type | Method and Description |
---|---|
void |
delete(K key)
Deletes the entry with a given key from the store.
|
void |
deleteAll(Collection<K> keys)
Deletes multiple entries from the store.
|
void |
store(K key,
V value)
Stores the key-value pair.
|
void |
storeAll(Map<K,V> map)
Stores multiple entries.
|
load, loadAll, loadAllKeys
void store(K key, V value)
If an exception is thrown then the put operation will fail.
key
- key of the entry to storevalue
- value of the entry to storevoid storeAll(Map<K,V> map)
Implementation of this method can optimize the store operation by storing all entries in one database connection. storeAll() is used when writeDelaySeconds is positive (write-behind).If an exception is thrown, the entries will try to be stored one by one using the store() method.
Note: on the retry phase only entries left in the map will be stored one-by-one. In this way a MapStore implementation can handle partial storeAll() cases when some entries were stored successfully before a failure happens. Entries removed from the map will be not passed to subsequent call to store() method any more.
map
- map of entries to storevoid delete(K key)
If an exception is thrown the remove operation will fail.
key
- the key to delete from the storevoid deleteAll(Collection<K> keys)
If an exception is thrown the entries will try to be deleted one by one using the delete() method.
Note: on the retry phase only entries left in the keys will be deleted one-by-one. In this way a MapStore implementation can handle partial deleteAll() cases when some entries were deleted successfully before a failure happens. Entries removed from the keys will be not passed to subsequent call to delete() method any more. The intended usage is to delete items from the provided collection as they are deleted from the store.
keys
- the keys of the entries to delete.Copyright © 2024 Hazelcast, Inc.. All rights reserved.