Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ReplicatedMap<K, V>

A specialized map whose values locally stored on every node of the cluster.

Methods that require serialization/deserialization may throw RangeError, e.g when there is no suitable serializer for a certain type.

Type parameters

  • K

  • V

Hierarchy

Index

Methods

addEntryListener

  • addEntryListener(listener: EntryListener<K, V>): Promise<string>
  • Adds an entry listener for this map. The listener will be notified for all map add/remove/update/evict events.

    Parameters

    • listener: EntryListener<K, V>

    Returns Promise<string>

    registration id of the listener

addEntryListenerToKey

  • addEntryListenerToKey(listener: EntryListener<K, V>, key: K): Promise<string>
  • Adds the specified entry listener for the specified key. The listener will be notified for all add/remove/update/evict events of the specified key only.

    Parameters

    • listener: EntryListener<K, V>

      listener object

    • key: K

      key to restrict events to associated entry

    Returns Promise<string>

    Registration id of the listener.

addEntryListenerToKeyWithPredicate

  • addEntryListenerToKeyWithPredicate(listener: EntryListener<K, V>, key: K, predicate: Predicate): Promise<string>
  • Adds a continuous entry listener for this map. The listener will be notified for map add/remove/update/evict events filtered by the given predicate.

    Parameters

    • listener: EntryListener<K, V>

      listener object

    • key: K

      key to restrict events to associated entry

    • predicate: Predicate

      predicate

    Returns Promise<string>

    registration id of the listener

addEntryListenerWithPredicate

  • addEntryListenerWithPredicate(listener: EntryListener<K, V>, predicate: Predicate): Promise<string>
  • Adds a continuous entry listener for this map. The listener will be notified for map add/remove/update/evict events filtered by the given predicate.

    Parameters

    • listener: EntryListener<K, V>

      listener object

    • predicate: Predicate

      predicate

    Returns Promise<string>

    registration id of the listener

clear

  • clear(): Promise<void>
  • Wipes data out of the replicated maps. If some node fails on executing the operation, it is retried for at most 5 times (on the failing nodes only).

    Returns Promise<void>

containsKey

  • containsKey(key: K): Promise<boolean>
  • Returns true if this map contains a mapping for the specified key. This message is idempotent.

    Parameters

    • key: K

      the key to search for

    Returns Promise<boolean>

    true if this map contains the specified key, false otherwise

containsValue

  • containsValue(value: V): Promise<boolean>
  • Returns true if this map maps one or more keys to the specified value.

    Parameters

    • value: V

      the value to search for

    Returns Promise<boolean>

    true if the specified value is associated with at least one key

destroy

  • destroy(): Promise<void>
  • Destroys this object cluster-wide. Clears all resources taken for this object.

    Returns Promise<void>

entrySet

  • entrySet(): Promise<[K, V][]>
  • Returns map entries as an array of key-value pairs.

    Returns Promise<[K, V][]>

    map entries as an array of key-value pairs

get

  • get(key: K): Promise<V>
  • Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

    If this map permits null values, then a return value of null does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to null. The containsKey operation may be used to distinguish these two cases. This message is idempotent.

    Parameters

    • key: K

      the key of the map entry

    Returns Promise<V>

    value associated with the specified key

getName

  • getName(): string
  • Returns the unique name of this object.

    Returns string

getPartitionKey

  • getPartitionKey(): string
  • Returns the key of the partition that this DistributedObject is assigned to. For a partitioned data structure, the returned value will not be null, but otherwise undefined.

    Returns string

getServiceName

  • getServiceName(): string

isEmpty

  • isEmpty(): Promise<boolean>
  • Returns Promise<boolean>

    true if this map has no entries, false otherwise

keySet

  • keySet(): Promise<K[]>
  • Returns a view of the key contained in this map.

    Returns Promise<K[]>

    keys of this map as an array

put

  • put(key: K, value: V, ttl?: number | Long): Promise<V>
  • Associates a given value to the specified key and replicates it to the cluster. If there is an old value, it will be replaced by the specified one and returned from the call.

    Parameters

    • key: K

      the key of the map entry

    • value: V

      new value

    • Optional ttl: number | Long

      optional time to live in milliseconds. 0 means infinite.

    Returns Promise<V>

    old value if there was any, null otherwise

putAll

  • putAll(pairs: [K, V][]): Promise<void>
  • Copies all the mappings from the specified key-value pairs array to this map.

    The behavior of this operation is undefined if the specified map is modified while the operation is in progress.

    Parameters

    • pairs: [K, V][]

      entries to be put

    Returns Promise<void>

remove

  • remove(key: K): Promise<V>
  • Removes the mapping for a key from this map if it is present.

    Parameters

    • key: K

      the key of the map entry

    Returns Promise<V>

    value associated with key, null if the key did not exist before

removeEntryListener

  • removeEntryListener(listenerId: string): Promise<boolean>
  • Removes the specified entry listener. Returns silently if there was no such listener added before. This message is idempotent.

    Parameters

    • listenerId: string

      registration id of the listener

    Returns Promise<boolean>

    true if remove operation is successful, false if unsuccessful or this listener did not exist

size

  • size(): Promise<number>
  • Returns the number of key-value mappings in this map. If the map contains more than Integer.MAX_VALUE (Java; 2^31-1) elements, returns Integer.MAX_VALUE.

    Returns Promise<number>

    the number of key-value mappings in this map.

values

  • values(comparator?: ListComparator<V>): Promise<ReadOnlyLazyList<V>>
  • Returns an eagerly populated collection view of the values contained in this map.

    Parameters

    • Optional comparator: ListComparator<V>

      optional ListComparator function to sort the returned elements

    Returns Promise<ReadOnlyLazyList<V>>

    a list of values contained in this map

Generated using TypeDoc