com.hazelcast.core
Interface MapLoader<K,V>

All Known Subinterfaces:
MapStore<K,V>

public interface MapLoader<K,V>

Hazelcast distributed map implementation is an in-memory data store but it can be backed by any type of data store such as RDBMS, OODBMS, or simply a file based data store.

IMap.get(key) normally returns the value that is available in-memory. If the entry doesn't exist in-memory, Hazelcast returns null. If a Loader implementation is provided then, instead of returning null, Hazelcast will load the unknown entry by calling the implementation's load (key) or loadAll(keys) methods. Loaded entries will be placed into the distributed map and they will stay in-memory until they are explicitly removed or implicitly evicted (if eviction is configured).


Method Summary
 V load(K key)
          Loads the value of a given key.
 Map<K,V> loadAll(Collection<K> keys)
          Loads given keys.
 Set<K> loadAllKeys()
          Loads all of the keys from the store.
 

Method Detail

load

V load(K key)
Loads the value of a given key. If distributed map doesn't contain the value for the given key then Hazelcast will call implementation's load (key) method to obtain the value. Implementation can use any means of loading the given key; such as an O/R mapping tool, simple SQL or reading a file etc.

Parameters:
key -
Returns:
value of the key

loadAll

Map<K,V> loadAll(Collection<K> keys)
Loads given keys. This is batch load operation so that implementation can optimize the multiple loads.

Parameters:
keys - keys of the values entries to load
Returns:
map of loaded key-value pairs.

loadAllKeys

Set<K> loadAllKeys()
Loads all of the keys from the store.

Returns:
all the keys


Copyright © 2008-2012 Hazel Ltd. All Rights Reserved.