public interface MapCodecTemplate
Modifier and Type | Method and Description |
---|---|
Object |
addEntryListener(String name,
boolean includeValue,
int listenerFlags,
boolean localOnly)
Adds a MapListener for this map.
|
Object |
addEntryListenerToKey(String name,
Data key,
boolean includeValue,
int listenerFlags,
boolean localOnly)
Adds a MapListener for this map.
|
Object |
addEntryListenerToKeyWithPredicate(String name,
Data key,
Data predicate,
boolean includeValue,
int listenerFlags,
boolean localOnly)
Adds a MapListener for this map.
|
Object |
addEntryListenerWithPredicate(String name,
Data predicate,
boolean includeValue,
int listenerFlags,
boolean localOnly)
Adds an continuous entry listener for this map.
|
void |
addIndex(String name,
String attribute,
boolean ordered)
Adds an index to this map for the specified entries so that queries can run faster.If you are querying your values
mostly based on age and active then you should consider indexing these fields.
|
Object |
addInterceptor(String name,
Data interceptor)
Adds an interceptor for this map.
|
Object |
addNearCacheEntryListener(String name,
int listenerFlags,
boolean localOnly)
Adds an entry listener for this map.
|
Object |
addPartitionLostListener(String name,
boolean localOnly)
Adds a MapPartitionLostListener.
|
void |
clear(String name)
This method clears the map and invokes MapStore#deleteAll deleteAll on MapStore which, if connected to a database,
will delete the records from that database.
|
void |
clearNearCache(String name,
Address target) |
Object |
containsKey(String name,
Data key,
long threadId)
Returns true if this map contains a mapping for the specified key.
|
Object |
containsValue(String name,
Data value)
Returns true if this map maps one or more keys to the specified value.This operation will probably require time
linear in the map size for most implementations of the Map interface.
|
void |
delete(String name,
Data key,
long threadId)
Removes the mapping for a key from this map if it is present.Unlike remove(Object), this operation does not return
the removed value, which avoids the serialization cost of the returned value.If the removed value will not be used,
a delete operation is preferred over a remove operation for better performance.
|
Object |
entriesWithPagingPredicate(String name,
Data predicate) |
Object |
entriesWithPredicate(String name,
Data predicate)
Queries the map based on the specified predicate and returns the matching entries.Specified predicate
runs on all members in parallel.
|
Object |
entrySet(String name)
Returns a Set clone of the mappings contained in this map.
|
Object |
evict(String name,
Data key,
long threadId)
Evicts the specified key from this map.
|
void |
evictAll(String name)
Evicts all keys from this map except the locked ones.
|
Object |
executeOnAllKeys(String name,
Data entryProcessor)
Applies the user defined EntryProcessor to the all entries in the map.Returns the results mapped by each key in the map.
|
Object |
executeOnKey(String name,
Data entryProcessor,
Data key,
long threadId)
Applies the user defined EntryProcessor to the entry mapped by the key.
|
Object |
executeOnKeys(String name,
Data entryProcessor,
List<Data> keys)
Applies the user defined EntryProcessor to the entries mapped by the collection of keys.The results mapped by
each key in the collection.
|
Object |
executeWithPredicate(String name,
Data entryProcessor,
Data predicate)
Applies the user defined EntryProcessor to the entries in the map which satisfies provided predicate.
|
void |
flush(String name)
If this map has a MapStore, this method flushes all the local dirty entries by calling MapStore.storeAll()
and/or MapStore.deleteAll().
|
void |
forceUnlock(String name,
Data key)
Releases the lock for the specified key regardless of the lock owner.It always successfully unlocks the key,
never blocks,and returns immediately.
|
Object |
get(String name,
Data key,
long threadId)
This method returns a clone of the original value, so modifying the returned value does not change the actual
value in the map.
|
Object |
getAll(String name,
List<Data> keys)
Returns the entries for the given keys.
|
Object |
getEntryView(String name,
Data key,
long threadId)
Returns the EntryView for the specified key.
|
Object |
isEmpty(String name)
Returns true if this map contains no key-value mappings.
|
Object |
isLocked(String name,
Data key)
Checks the lock for the specified key.If the lock is acquired then returns true, else returns false.
|
Object |
keySet(String name)
Returns a set clone of the keys contained in this map.
|
Object |
keySetWithPagingPredicate(String name,
Data predicate) |
Object |
keySetWithPredicate(String name,
Data predicate)
Queries the map based on the specified predicate and returns the keys of matching entries.
|
void |
loadAll(String name,
boolean replaceExistingValues)
Loads all keys into the store.
|
void |
loadGivenKeys(String name,
List<Data> keys,
boolean replaceExistingValues)
Loads the given keys.
|
void |
lock(String name,
Data key,
long threadId,
long ttl)
Acquires the lock for the specified lease time.After lease time, lock will be released.If the lock is not
available then the current thread becomes disabled for thread scheduling purposes and lies dormant until the lock
has been acquired.
|
Object |
put(String name,
Data key,
Data value,
long threadId,
long ttl)
Puts an entry into this map with a given ttl (time to live) value.Entry will expire and get evicted after the ttl
If ttl is 0, then the entry lives forever.This method returns a clone of the previous value, not the original
(identically equal) value previously put into the map.Time resolution for TTL is seconds.
|
void |
putAll(String name,
Map<Data,Data> entries)
Copies all of the mappings from the specified map to this map (optional operation).The effect of this call is
equivalent to that of calling put(Object,Object) put(k, v) on this map once for each mapping from key k to value
v in the specified map.The behavior of this operation is undefined if the specified map is modified while the
operation is in progress.
|
Object |
putIfAbsent(String name,
Data key,
Data value,
long threadId,
long ttl)
Puts an entry into this map with a given ttl (time to live) value if the specified key is not already associated
with a value.
|
void |
putTransient(String name,
Data key,
Data value,
long threadId,
long ttl)
Same as put except that MapStore, if defined, will not be called to store/persist the entry.
|
Object |
remove(String name,
Data key,
long threadId)
Removes the mapping for a key from this map if it is present (optional operation).
|
Object |
removeEntryListener(String name,
String registrationId)
Removes the specified entry listener.
|
Object |
removeIfSame(String name,
Data key,
Data value,
long threadId)
Removes the mapping for a key from this map if existing value equal to the this value
|
Object |
removeInterceptor(String name,
String id)
Removes the given interceptor for this map so it will not intercept operations anymore.
|
Object |
removePartitionLostListener(String name,
String registrationId)
Removes the specified map partition lost listener.
|
Object |
replace(String name,
Data key,
Data value,
long threadId)
Replaces the entry for a key only if currently mapped to a given value.
|
Object |
replaceIfSame(String name,
Data key,
Data testValue,
Data value,
long threadId)
Replaces the the entry for a key only if existing values equal to the testValue
|
void |
set(String name,
Data key,
Data value,
long threadId,
long ttl)
Puts an entry into this map with a given ttl (time to live) value.Entry will expire and get evicted after the ttl
If ttl is 0, then the entry lives forever.
|
Object |
size(String name)
Returns the number of key-value mappings in this map.
|
Object |
submitToKey(String name,
Data entryProcessor,
Data key,
long threadId)
Applies the user defined EntryProcessor to the entry mapped by the key.
|
Object |
tryLock(String name,
Data key,
long threadId,
long lease,
long timeout)
Tries to acquire the lock for the specified key for the specified lease time.After lease time, the lock will be
released.If the lock is not available, then the current thread becomes disabled for thread scheduling
purposes and lies dormant until one of two things happens the lock is acquired by the current thread, or
the specified waiting time elapses.
|
Object |
tryPut(String name,
Data key,
Data value,
long threadId,
long timeout)
Tries to put the given key and value into this map within a specified timeout value.
|
Object |
tryRemove(String name,
Data key,
long threadId,
long timeout)
Tries to remove the entry with the given key from this map within the specified timeout value.
|
void |
unlock(String name,
Data key,
long threadId)
Releases the lock for the specified key.
|
Object |
values(String name)
Returns a collection clone of the values contained in this map.
|
Object |
valuesWithPagingPredicate(String name,
Data predicate)
Queries the map based on the specified predicate and returns the values of matching entries.
|
Object |
valuesWithPredicate(String name,
Data predicate)
Queries the map based on the specified predicate and returns the values of matching entries.Specified predicate
runs on all members in parallel.
|
Object put(String name, Data key, Data value, long threadId, long ttl)
name
- Name of the map.key
- Key for the map entry.value
- Value for the map entry.threadId
- The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.ttl
- The duration in milliseconds after which this entry shall be deleted. O means infinite.Object get(String name, Data key, long threadId)
name
- Name of the map.key
- Key for the map entry.threadId
- The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.Object remove(String name, Data key, long threadId)
name
- Name of the map.key
- Key for the map entry.threadId
- The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.Object replace(String name, Data key, Data value, long threadId)
name
- Name of the map.key
- Key for the map entry.value
- New value for the map entry.threadId
- The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.Object replaceIfSame(String name, Data key, Data testValue, Data value, long threadId)
name
- Name of the map.key
- Key for the map entry.testValue
- Test the existing value against this value to find if equal to this value.value
- New value for the map entry. Only replace with this value if existing value is equal to the testValue.threadId
- The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.Object containsKey(String name, Data key, long threadId)
name
- Name of the map.key
- Key for the map entry.threadId
- The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.Object containsValue(String name, Data value)
name
- Name of the map.value
- Value to check if exists in the map.Object removeIfSame(String name, Data key, Data value, long threadId)
name
- Name of the map.key
- Key for the map entry.value
- Test the existing value against this value to find if equal to this value. Only remove the entry from the map if the value is equal to this value.threadId
- The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.void delete(String name, Data key, long threadId)
name
- Name of the map.key
- Key for the map entry.threadId
- The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.void flush(String name)
name
- Name of the map.Object tryRemove(String name, Data key, long threadId, long timeout)
name
- Name of the map.key
- Key for the map entry.threadId
- The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.timeout
- maximum time in milliseconds to wait for acquiring the lock for the key.Object tryPut(String name, Data key, Data value, long threadId, long timeout)
name
- Name of the map.key
- Key for the map entry.value
- New value for the map entry.threadId
- The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.timeout
- maximum time in milliseconds to wait for acquiring the lock for the key.void putTransient(String name, Data key, Data value, long threadId, long ttl)
name
- Name of the map.key
- Key for the map entry.value
- New value for the map entry.threadId
- The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.ttl
- The duration in milliseconds after which this entry shall be deleted. O means infinite.Object putIfAbsent(String name, Data key, Data value, long threadId, long ttl)
name
- Name of the map.key
- Key for the map entry.value
- New value for the map entry.threadId
- The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.ttl
- The duration in milliseconds after which this entry shall be deleted. O means infinite.void set(String name, Data key, Data value, long threadId, long ttl)
name
- Name of the map.key
- Key for the map entry.value
- New value for the map entry.threadId
- The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.ttl
- The duration in milliseconds after which this entry shall be deleted. O means infinite.void lock(String name, Data key, long threadId, long ttl)
name
- Name of the map.key
- Key for the map entry.threadId
- The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.ttl
- The duration in milliseconds after which this entry shall be deleted. O means infinite.Object tryLock(String name, Data key, long threadId, long lease, long timeout)
name
- Name of the map.key
- Key for the map entry.threadId
- The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.lease
- time in milliseconds to wait before releasing the lock.timeout
- maximum time to wait for getting the lock.Object isLocked(String name, Data key)
name
- name of mapkey
- Key for the map entry to check if it is locked.void unlock(String name, Data key, long threadId)
name
- name of mapkey
- Key for the map entry to unlockthreadId
- The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.Object addInterceptor(String name, Data interceptor)
name
- name of mapinterceptor
- interceptor to addObject removeInterceptor(String name, String id)
name
- name of mapid
- of interceptorObject addEntryListenerToKeyWithPredicate(String name, Data key, Data predicate, boolean includeValue, int listenerFlags, boolean localOnly)
name
- name of mapkey
- Key for the map entry.predicate
- predicate for filtering entries.includeValue
- true if EntryEvent should
contain the value.listenerFlags
- flags of enabled listeners.localOnly
- if true fires events that originated from this node only, otherwise fires all eventsObject addEntryListenerWithPredicate(String name, Data predicate, boolean includeValue, int listenerFlags, boolean localOnly)
name
- name of mappredicate
- predicate for filtering entries.includeValue
- true if EntryEvent should
contain the value.listenerFlags
- flags of enabled listeners.localOnly
- if true fires events that originated from this node only, otherwise fires all eventsObject addEntryListenerToKey(String name, Data key, boolean includeValue, int listenerFlags, boolean localOnly)
name
- name of mapkey
- Key for the map entry.includeValue
- true if EntryEvent should contain the value.listenerFlags
- flags of enabled listeners.localOnly
- if true fires events that originated from this node only, otherwise fires all eventsObject addEntryListener(String name, boolean includeValue, int listenerFlags, boolean localOnly)
name
- name of mapincludeValue
- true if EntryEvent should contain the value.listenerFlags
- flags of enabled listeners.localOnly
- if true fires events that originated from this node only, otherwise fires all eventsObject addNearCacheEntryListener(String name, int listenerFlags, boolean localOnly)
name
- name of maplistenerFlags
- flags of enabled listeners.localOnly
- if true fires events that originated from this node only, otherwise fires all eventsObject removeEntryListener(String name, String registrationId)
name
- name of mapregistrationId
- id of registered listener.Object addPartitionLostListener(String name, boolean localOnly)
name
- name of maplocalOnly
- if true fires events that originated from this node only, otherwise fires all eventsObject removePartitionLostListener(String name, String registrationId)
name
- name of mapregistrationId
- id of registerObject getEntryView(String name, Data key, long threadId)
name
- name of mapkey
- the key of the entry.threadId
- The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.Object evict(String name, Data key, long threadId)
name
- name of mapkey
- the specified key to evict from this map.threadId
- The id of the user thread performing the operation. It is used to guarantee that only the lock holder thread (if a lock exists on the entry) can perform the requested operation.void evictAll(String name)
name
- name of mapvoid loadAll(String name, boolean replaceExistingValues)
name
- name of mapreplaceExistingValues
- when true
, existing values in the Map will
be replaced by those loaded from the MapLoadervoid loadGivenKeys(String name, List<Data> keys, boolean replaceExistingValues)
name
- name of mapkeys
- keys to loadreplaceExistingValues
- when true
, existing values in the Map will be replaced by those loaded from the MapLoaderObject keySet(String name)
name
- name of the mapGroupProperty.QUERY_RESULT_SIZE_LIMIT
Object getAll(String name, List<Data> keys)
name
- name of mapkeys
- keys to getObject values(String name)
name
- name of mapGroupProperty.QUERY_RESULT_SIZE_LIMIT
Object entrySet(String name)
name
- name of mapGroupProperty.QUERY_RESULT_SIZE_LIMIT
Object keySetWithPredicate(String name, Data predicate)
name
- name of map.predicate
- specified query criteria.GroupProperty.QUERY_RESULT_SIZE_LIMIT
Object valuesWithPredicate(String name, Data predicate)
name
- name of mappredicate
- specified query criteria.GroupProperty.QUERY_RESULT_SIZE_LIMIT
Object entriesWithPredicate(String name, Data predicate)
name
- name of mappredicate
- specified query criteria.GroupProperty.QUERY_RESULT_SIZE_LIMIT
void addIndex(String name, String attribute, boolean ordered)
name
- name of mapattribute
- index attribute of valueordered
- true if index should be ordered, false otherwise.Object size(String name)
name
- of mapObject isEmpty(String name)
name
- name of mapvoid putAll(String name, Map<Data,Data> entries)
name
- name of mapentries
- mappings to be stored in this mapvoid clear(String name)
name
- of mapObject executeOnKey(String name, Data entryProcessor, Data key, long threadId)
name
- name of mapentryProcessor
- processor to execute on the map entrykey
- the key of the map entry.Object submitToKey(String name, Data entryProcessor, Data key, long threadId)
name
- name of mapentryProcessor
- entry processor to be executed on the entry.key
- the key of the map entry.Object executeOnAllKeys(String name, Data entryProcessor)
name
- name of mapentryProcessor
- entry processor to be executed.Object executeWithPredicate(String name, Data entryProcessor, Data predicate)
name
- name of mapentryProcessor
- entry processor to be executed.predicate
- specified query criteria.Object executeOnKeys(String name, Data entryProcessor, List<Data> keys)
name
- name of mapentryProcessor
- entry processor to be executed.keys
- The keys for the entries for which the entry processor shall be executed on.void forceUnlock(String name, Data key)
name
- name of mapkey
- the key of the map entry.Object keySetWithPagingPredicate(String name, Data predicate)
name
- name of mappredicate
- specified query criteria.Object valuesWithPagingPredicate(String name, Data predicate)
name
- name of mappredicate
- specified query criteria.GroupProperty.QUERY_RESULT_SIZE_LIMIT
Object entriesWithPagingPredicate(String name, Data predicate)
name
- name of mappredicate
- specified query criteria.Copyright © 2016 Hazelcast, Inc.. All Rights Reserved.