the type of the map entry keys
the type of the map entry values
Readonly
activetrue
if this cache is active.
Readonly
destroyedSignifies if this NamedMap
has been destroyed.
Readonly
emptytrue
if this map contains no key-value mappings.
Readonly
nameThe name of this NamedMap
.
Readonly
releasedtrue
if this cache has been released
Readonly
sizeSignifies the number of key-value mappings in this map.
the number of key-value mappings in this map
Add an index to this map.
Adds an index to this map. Example:
cache.addIndex(Extractors.extract('name'))
A Promise
The ValueExtractor object that is used to extract an indexable Object from a value stored in the indexed Map. Must not be null.
Optional
ordered: booleantrue iff the contents of the indexed information should be ordered false otherwise.
Optional
comparator: ComparatorThe Comparator object which imposes an ordering on entries in the indexed map or null if the entries' values natural ordering should be used.
Add a MapListener that will receive events (inserts, updates, deletes) that occur against the map, with the key, old-value and new-value included.
the MapListener to receive events
Optional
keyOrFilter: Filter | Kthe optional the key that identifies the entry for which to raise events or a filter that
will be passed MapEvent objects to select from; a MapEvent will be delivered to the
listener only if the filter evaluates to true for that MapEvent
(see MapEventFilter);
null
is equivalent to a filter that always returns true
Optional
isLite: booleanoptionally pass true
to indicate that the MapEvent objects do not have to include the
old or new values in order to allow optimizations
Perform an aggregating operation against the entries specified by the passed keys.
the type of value returned by the EntryProcessor
the Iterable of keys that specify the entries within this Map to aggregate across
the EntryAggregator that is used to aggregate across the specified entries of this Map
Perform an aggregating operation against the set of entries that are selected by the given Filter.
the type of value returned by the EntryProcessor
the Filter that is used to select entries within this Map to aggregate across
the EntryAggregator that is used to aggregate across the specified entries of this Map
Perform an aggregating operation against all the entries.
the type of value returned by the EntryProcessor
the EntryAggregator that is used to aggregate across the specified entries of this Map
Release and destroy this cache.
Warning: This method is used to completely destroy the specified cache across the cluster. All references in the entire cluster to this cache will be invalidated, the cached data will be cleared, and all resources will be released.
Returns a Set view of the mappings contained in this map.
The set is backed by the map, so changes to the map are
reflected in the set, and vice-versa. If the map is modified
while an iteration over the set is in progress (except through
the iterator's own remove
operation) the results of the iteration
are undefined. The set supports element removal, which removes
the corresponding mapping from the map.
a set view of the mappings contained in this map
Return a set view of the entries contained in this map that satisfy the criteria expressed by the filter. Each element in the returned set is a MapEntry.
Unlike the #entrySet() method, the set returned by this method may not be backed by the map, so changes to the set may not be reflected in the map, and vice-versa.
a set of entries that satisfy the specified criteria
the Filter object representing the criteria that the entries of this map should satisfy
Optional
comparator: Comparatorthe Comparator object which imposes an ordering on
entries in the resulting set; or null
if the
entries' values natural ordering should be used
Perform the given action for each entry selected by the specified key set until all entries have been processed or the action raises an error.
Errors raised by the action are relayed to the caller.
The implementation processes each entry on the client and should only be used for read-only client-side operations (such as adding map entries to a UI widget, for example).
Any entry mutation caused by the specified action will not be propagated to the server when this method is called on a distributed map, so it should be avoided. The mutating operations on a subset of entries should be implemented using invokeAll.
Perform the given action for each entry selected by the specified key set until all entries have been processed or the action raises an error.
Errors raised by the action are relayed to the caller.
The implementation processes each entry on the client and should only be used for read-only client-side operations (such as adding map entries to a UI widget, for example).
Any entry mutation caused by the specified action will not be propagated to the server when this method is called on a distributed map, so it should be avoided. The mutating operations on a subset of entries should be implemented using invokeAll.
the action to be performed for each entry
the keys to process these keys are not required to exist within the Map
Optional
thisArg: anyoptional argument to be used as this when invoking the action
Perform the given action for each entry selected by the specified key set until all entries have been processed or the action raises an error.
Errors raised by the action are relayed to the caller.
The implementation processes each entry on the client and should only be used for read-only client-side operations (such as adding map entries to a UI widget, for example).
Any entry mutation caused by the specified action will not be propagated to the server when this method is called on a distributed map, so it should be avoided. The mutating operations on a subset of entries should be implemented using invokeAll.
Returns the value to which this cache maps the specified key.
a Promise
resolving the value to which the specified key is mapped,
or null
if this map contains no mapping for the key
the key whose associated value is to be returned
Get all the specified keys, if they are in the map. For each key that is in the map, that key and its corresponding value will be placed in the map that is returned by this method. The absence of a key in the returned map indicates that it was not in the cache, which may imply (for caches that can load behind the scenes) that the requested data could not be loaded.
a Promise
resolving to a Map of keys to values for the specified keys
passed in keys
an Iterable of keys that may be in this map
Returns the value to which the specified key is mapped, or the specified defaultValue
if this map contains no mapping for the key.
the value to which the specified key is mapped, or the specified defaultValue
if this map contains no mapping for the key
Returns true
if the specified key is mapped to the specified value within the cache.
a Promise
resolving to true
if the key is mapped
to the specified value, or false
if it does not
the key
the value
Invoke the passed EntryProcessor against the entry specified by the passed key, returning the result of the invocation.
the result of the invocation as returned from the EntryProcessor
the type of value returned by the EntryProcessor
the key to process it is not required to exist within the Map
the EntryProcessor to use to process the specified key
Invoke the passed EntryProcessor against the entries specified by the passed keys, returning the result of the invocation for each.
a Map containing the results of invoking the EntryProcessor against each of the specified keys
the type of value returned by the EntryProcessor
the EntryProcessor to use to process the specified keys
Invoke the passed EntryProcessor against the entries specified by the passed keys, returning the result of the invocation for each.
the type of value returned by the EntryProcessor
the keys to process these keys are not required to exist within the Map
the EntryProcessor to use to process the specified keys
Invoke the passed EntryProcessor against the set of entries that are selected by the given Filter, returning the result of the invocation for each.
Unless specified otherwise, implementations will perform this operation in two steps: 1. use the filter to retrieve a matching entry set 2. apply the agent to every filtered entry.
This algorithm assumes that the agent's processing does not affect the result of the specified filter evaluation, since the filtering and processing could be performed in parallel on different threads. If this assumption does not hold, the processor logic has to be idempotent, or at least re-evaluate the filter. This could be easily accomplished by wrapping the processor with the ConditionalProcessor.
the type of value returned by the EntryProcessor
a Filter that results in the set of keys to be processed
the EntryProcessor to use to process the specified keys
Returns a Set view of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation), the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map.
a set view of the keys contained in this map
Return a set view of the keys contained in this map for entries that satisfy the criteria expressed by the filter.
Unlike the #keySet() method, the set returned by this method may not be backed by the map, so changes to the set may not be reflected in the map, and vice-versa.
a set of keys for entries that satisfy the specified criteria
Allows registration of a handler to be notified of cache lifecycle events.
the event
the event handler
Remove an index from this NamedMap
.
Removes an index to this NamedMap
. Example:
cache.removeIndex(Extractors.extract('name'))
A Promise
that resolves when the operation completes.
The ValueExtractor object that is used to extract
an indexable Object from a value stored in the
indexed Map. Must not be null
.
Remove a standard map listener that previously signed up for all events. This has the same result as the following call:
the MapListener to receive events
Optional
keyOrFilter: K | MapEventFilter<K, V>the key or filter passed to a previous addMapListener invocation
Removes the entry for the specified key only if it is currently mapped to the specified value.
a Promise
resolving to true
if the value was removed
key with which the specified value is associated
expected to be associated with the specified key
Replaces the entry for the specified key only if it is currently mapped to some value.
a Promise
resolving to the previous value associated with the specified key,
or null
if there was no mapping for the key. (A null
return can also indicate that the map
previously associated null
with the key, if the implementation supports null
values.)
key with which the specified value is associated
value to be associated with the specified key
Replaces the entry for the specified key only if currently mapped to the specified value.
a Promise
resolving to true
if the value was replaced
key whose associated value is to be removed
value expected to be associated with the specified key
value to be associated with the specified key
Associates the specified value with the specified key in this map. If the map previously contained a mapping for this key, the old value is replaced.
a Promise
resolving to the previous value associated with specified key,
or null
if there was no mapping for key. A null
return can also indicate that the map
previously associated null
with the specified key, if the implementation supports null
values
the key with which the specified value is to be associated
the value to be associated with the specified key
Optional
ttl: numberthe expiry time in millis (optional)
If the specified key is not already associated with a value (or is mapped to null) associates
it with the given value and returns nul
l, else returns the current value.
a Promise
resolving to the previous value associated with the specified key, or
null
if there was no mapping for the key. (A null
return can also indicate that the map previously
associated null
with the key, if the implementation supports null
values.)
the key with which the specified value is to be associated
the value to be associated with the specified key
Optional
ttl: numberthe expiry time in millis
Truncates the cache. Unlike clear, this function does not generate an event for each removed entry.
a Promise
which resolves once the operation is complete
Returns a Set view of the values contained in this map.
The collection is backed by the map, so changes to the map are
reflected in the collection, and vice-versa. If the map is
modified while an iteration over the collection is in progress
(except through the iterator's own remove
operation),
the results of the iteration are undefined.
a Promise
that resolves to the values in the set
Return a Set of the values contained in this map that satisfy the criteria expressed by the filter.
Unlike the #values() method, the collection returned by this method may not be backed by the map, so changes to the collection may not be reflected in the map, and vice-versa.
a Promise
that resolves to the values in the set that satisfy
the specified criteria
the Filter object representing the criteria that the entries of this map should satisfy
Optional
comparator: Comparatorthe Comparator object which imposes an ordering on entries in the resulting set; or null if the entries' values natural ordering should be used
A Map-based data-structure that manages entries across one or more processes. Entries are typically managed in memory, and are often comprised of data that is also stored in an external system, for example a database, or data that has been assembled or calculated at some significant cost. Such entries are referred to as being cached.