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 persistently, on disk.

Type Parameters

  • K

    the type of the map entry keys

  • V

    the type of the map entry values

Hierarchy

Properties

active: boolean

true if this cache is active.

destroyed: boolean

Signifies if this NamedMap has been destroyed.

empty: Promise<boolean>

true if this map contains no key-value mappings.

name: string

The name of this NamedMap.

released: boolean

true if this cache has been released

size: Promise<number>

Signifies the number of key-value mappings in this map.

Returns

the number of key-value mappings in this map

Methods

  • Add an index to this map.

    Remarks

    Adds an index to this map. Example:

    cache.addIndex(Extractors.extract('name'))
    

    Returns

    A Promise that resolves when the operation completes.

    Parameters

    • extractor: ValueExtractor

      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: boolean

      true iff the contents of the indexed information should be ordered false otherwise.

    • Optional comparator: Comparator

      The Comparator object which imposes an ordering on entries in the indexed map or null if the entries' values natural ordering should be used.

    Returns Promise<void>

  • Add a MapListener that will receive events (inserts, updates, deletes) that occur against the map, with the key, old-value and new-value included.

    Parameters

    • listener: MapListener<K, V>

      the MapListener to receive events

    • Optional keyOrFilter: Filter | K

      the 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: boolean

      optionally pass true to indicate that the MapEvent objects do not have to include the old or new values in order to allow optimizations

    Returns Promise<void>

  • Perform an aggregating operation against the entries specified by the passed keys.

    Type Parameters

    Parameters

    • keys: Iterable<K>

      the Iterable of keys that specify the entries within this Map to aggregate across

    • aggregator: EntryAggregator<K, V, R>

      the EntryAggregator that is used to aggregate across the specified entries of this Map

    Returns Promise<R>

  • Perform an aggregating operation against the set of entries that are selected by the given Filter.

    Type Parameters

    Parameters

    • filter: Filter

      the Filter that is used to select entries within this Map to aggregate across

    • aggregator: EntryAggregator<K, V, R>

      the EntryAggregator that is used to aggregate across the specified entries of this Map

    Returns Promise<R>

  • Perform an aggregating operation against all the entries.

    Type Parameters

    Parameters

    Returns Promise<R>

  • Clears all the mappings in the 'NamedMap'.

    Returns

    a Promise which resolves once the operation is complete

    Returns Promise<void>

  • Removes the mapping for a key from this map if it is present.

    Returns

    a Promiseresolving to the previous value associated with key, or null if there was no mapping for key

    Parameters

    • key: K

      key whose mapping is to be removed from the map

    Returns Promise<null | V>

  • 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 Promise<void>

  • 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.

    Returns

    a set view of the mappings contained in this map

    Returns Promise<RemoteSet<MapEntry<K, V>>>

  • 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.

    Returns

    a set of entries that satisfy the specified criteria

    Parameters

    • filter: Filter

      the Filter object representing the criteria that the entries of this map should satisfy

    • Optional comparator: Comparator

      the Comparator object which imposes an ordering on entries in the resulting set; or null if the entries' values natural ordering should be used

    Returns Promise<RemoteSet<MapEntry<K, V>>>

  • 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.

    Parameters

    • action: ((value: V, key: K, map: NamedMap<K, V>) => void)

      the action to be performed for each entry

        • (value: V, key: K, map: NamedMap<K, V>): void
        • Parameters

          Returns void

    • Optional thisArg: any

      optional argument to be used as this when invoking the action

    Returns Promise<void>

  • 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.

    Parameters

    • action: ((value: V, key: K, map: NamedMap<K, V>) => void)

      the action to be performed for each entry

        • (value: V, key: K, map: NamedMap<K, V>): void
        • Parameters

          Returns void

    • keys: Iterable<K>

      the keys to process these keys are not required to exist within the Map

    • Optional thisArg: any

      optional argument to be used as this when invoking the action

    Returns Promise<void>

  • 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.

    Parameters

    • action: ((value: V, key: K, map: NamedMap<K, V>) => void)

      the action to be performed for each entry

        • (value: V, key: K, map: NamedMap<K, V>): void
        • Parameters

          Returns void

    • filter: Filter

      the filter criteria to apply to the entries

    • Optional thisArg: any

      optional argument to be used as this when invoking the action

    Returns Promise<void>

  • Returns the value to which this cache maps the specified key.

    Returns

    a Promise resolving the value to which the specified key is mapped, or null if this map contains no mapping for the key

    Parameters

    • key: K

      the key whose associated value is to be returned

    Returns Promise<null | V>

  • 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.

    Returns

    a Promiseresolving to a Map of keys to values for the specified keys passed in keys

    Parameters

    • keys: Iterable<K>

      an Iterable of keys that may be in this map

    Returns Promise<Map<K, V>>

  • Returns the value to which the specified key is mapped, or the specified defaultValue if this map contains no mapping for the key.

    Returns

    the value to which the specified key is mapped, or the specified defaultValue if this map contains no mapping for the key

    Parameters

    • key: K
    • defaultValue: V

    Returns Promise<null | V>

  • Returns true if the specified key is mapped a value within the cache.

    Returns

    a Promise resolving to true if the key is mapped to a value, or false if it does not

    Parameters

    • key: K

      the key whose presence in this cache is to be tested

    Returns Promise<boolean>

  • Returns true if the specified key is mapped to the specified value within the cache.

    Returns

    a Promise resolving to true if the key is mapped to the specified value, or false if it does not

    Parameters

    • key: K

      the key

    • value: V

      the value

    Returns Promise<boolean>

  • Returns true if the specified value is mapped to some key.

    Returns

    a Promise resolving to true if a mapping exists, or false if it does not

    Parameters

    • value: V

      the value expected to be associated with some key

    Returns Promise<boolean>

  • Invoke the passed EntryProcessor against the entry specified by the passed key, returning the result of the invocation.

    Returns

    the result of the invocation as returned from the EntryProcessor

    Type Parameters

    Parameters

    • key: K

      the key to process it is not required to exist within the Map

    • processor: EntryProcessor<K, V, R>

      the EntryProcessor to use to process the specified key

    Returns Promise<null | R>

  • Invoke the passed EntryProcessor against the entries specified by the passed keys, returning the result of the invocation for each.

    Returns

    a Map containing the results of invoking the EntryProcessor against each of the specified keys

    Type Parameters

    Parameters

    Returns Promise<Map<K, R>>

  • Invoke the passed EntryProcessor against the entries specified by the passed keys, returning the result of the invocation for each.

    Type Parameters

    Parameters

    • keys: Iterable<K>

      the keys to process these keys are not required to exist within the Map

    • processor: EntryProcessor<K, V, R>

      the EntryProcessor to use to process the specified keys

    Returns Promise<Map<K, R>>

  • 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.

    Type Parameters

    Parameters

    Returns Promise<Map<K, R>>

  • 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.

    Returns

    a set view of the keys contained in this map

    Returns Promise<RemoteSet<K>>

  • 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.

    Returns

    a set of keys for entries that satisfy the specified criteria

    Parameters

    • filter: Filter

      the Filter object representing the criteria that the entries of this map should satisfy

    Returns Promise<RemoteSet<K>>

  • Allows registration of a handler to be notified of cache lifecycle events.

    Parameters

    • eventName: MapLifecycleEvent

      the event

    • handler: ((cacheName: string) => void)

      the event handler

        • (cacheName: string): void
        • Parameters

          • cacheName: string

          Returns void

    Returns void

  • Release local resources associated with instance.

    Returns Promise<void>

  • Remove an index from this NamedMap.

    Removes an index to this NamedMap. Example:

    cache.removeIndex(Extractors.extract('name'))
    

    Returns

    A Promise that resolves when the operation completes.

    Parameters

    • extractor: ValueExtractor

      The ValueExtractor object that is used to extract an indexable Object from a value stored in the indexed Map. Must not be null.

    Returns Promise<void>

  • Remove a standard map listener that previously signed up for all events. This has the same result as the following call:

    Parameters

    Returns Promise<void>

  • Removes the entry for the specified key only if it is currently mapped to the specified value.

    Returns

    a Promiseresolving to true if the value was removed

    Parameters

    • key: K

      key with which the specified value is associated

    • value: V

      expected to be associated with the specified key

    Returns Promise<boolean>

  • Replaces the entry for the specified key only if it is currently mapped to some value.

    Returns

    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.)

    Parameters

    • key: K

      key with which the specified value is associated

    • value: V

      value to be associated with the specified key

    Returns Promise<null | V>

  • Replaces the entry for the specified key only if currently mapped to the specified value.

    Returns

    a Promise resolving to true if the value was replaced

    Parameters

    • key: K

      key whose associated value is to be removed

    • oldValue: V

      value expected to be associated with the specified key

    • newValue: V

      value to be associated with the specified key

    Returns Promise<boolean>

  • 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.

    Returns

    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

    Parameters

    • key: K

      the key with which the specified value is to be associated

    • value: V

      the value to be associated with the specified key

    Returns Promise<null | V>

  • Copies all mappings from the specified map to this map

    Parameters

    • map: Map<K, V>

      the map to copy from

    Returns Promise<void>

  • If the specified key is not already associated with a value (or is mapped to null) associates it with the given value and returns null, else returns the current value.

    Returns

    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.)

    Parameters

    • key: K

      the key with which the specified value is to be associated

    • value: V

      the value to be associated with the specified key

    Returns Promise<null | V>

  • Truncates the cache. Unlike clear, this function does not generate an event for each removed entry.

    Returns

    a Promise which resolves once the operation is complete

    Returns Promise<void>

  • 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.

    Returns

    a Promise that resolves to the values in the set

    Returns Promise<RemoteSet<V>>

  • 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.

    Returns

    a Promise that resolves to the values in the set that satisfy the specified criteria

    Parameters

    • filter: Filter

      the Filter object representing the criteria that the entries of this map should satisfy

    • Optional comparator: Comparator

      the Comparator object which imposes an ordering on entries in the resulting set; or null if the entries' values natural ordering should be used

    Returns Promise<RemoteSet<V>>