Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IMap<K, V>

Type parameters

  • K

  • V

Hierarchy

Implemented by

Index

Methods

addEntryListener

  • addEntryListener(listener: IMapListener<K, V>, key?: K, includeValue?: boolean): Promise
  • Adds a IMapListener for this map.

    Parameters

    • listener: IMapListener<K, V>
    • Optional key: K

      Events are triggered for only this key if set.

    • Optional includeValue: boolean

      Event message contains new value of the key if set to {true}.

    Returns Promise

    Registration id of the listener.

addEntryListenerWithPredicate

  • addEntryListenerWithPredicate(listener: IMapListener<K, V>, predicate: Predicate, key?: K, includeValue?: boolean): Promise
  • Adds a IMapListener for this map. Listener will get notified for map add/remove/update/evict events filtered by the given predicate.

    Parameters

    • listener: IMapListener<K, V>
    • predicate: Predicate
    • Optional key: K

      Events are triggered for only this key if set.

    • Optional includeValue: boolean

      Event message contains new value of the key if set to true.

    Returns Promise

    Registration id of the listener.

addIndex

  • addIndex(attribute: string, ordered: boolean): Promise
  • Adds an index to this map for the specified entries so that queries can run faster.

    Parameters

    • attribute: string

      index attribute of value

    • ordered: boolean

      true if index should be ordered, false otherwise.

    Returns Promise

clear

  • clear(): Promise

containsKey

  • containsKey(key: K): Promise
  • This method checks whether the map has an item asssociated with key

    throws

    {RangeError} if key is undefined or null

    Parameters

    • key: K

    Returns Promise

    true if the map contains the key, false otherwise.

containsValue

  • containsValue(value: V): Promise
  • This method return true if this map has key(s) associated with given value

    throws

    {RangeError} if value is undefined or null

    Parameters

    • value: V

    Returns Promise

    true if the map has key or keys associated with given value.

delete

  • delete(key: K): Promise
  • Removes specified key from map. Unlike remove this method does not return deleted value. Therefore it eliminates deserialization cost of returned value.

    throws

    {RangeError} if key is null or undefined.

    Parameters

    • key: K

    Returns Promise

destroy

  • destroy(): Promise

entrySet

  • entrySet(): Promise
  • Returns entries as an array of key-value pairs.

    Returns Promise

entrySetWithPredicate

  • entrySetWithPredicate(predicate: Predicate): Promise
  • Queries the map based on the specified predicate and returns matching entries. Specified predicate runs on all members in parallel.

    Parameters

    • predicate: Predicate

      specified query criteria.

    Returns Promise

    result entry set of the query.

evict

  • evict(key: K): Promise
  • Evicts the specified key from this map.

    throws

    {RangeError} if key is null or undefined.

    Parameters

    • key: K

    Returns Promise

evictAll

  • evictAll(): Promise

flush

  • flush(): Promise
  • If this map has a MapStore, this method flushes all local dirty entries.

    Returns Promise

forceUnlock

  • forceUnlock(key: K): Promise
  • Releases the lock for the specified key regardless of the owner. It always unlocks the key.

    throws

    {RangeError} if key is null or undefined.

    Parameters

    • key: K

    Returns Promise

get

  • get(key: K): Promise
  • Retrieves the value associated with given key.

    throws

    {RangeError} if key is undefined or null

    Parameters

    • key: K

    Returns Promise

    value associated with key, undefined if the key does not exist.

getAll

  • getAll(keys: K[]): Promise
  • Retrieves key value pairs of given keys.

    Parameters

    • keys: K[]

      the array of keys

    Returns Promise

getEntryView

  • getEntryView(key: K): Promise
  • Returns a key-value pair representing the association of given key

    throws

    {RangeError} if key is null or undefined.

    Parameters

    • key: K

    Returns Promise

getName

  • getName(): 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
  • Returns whether this map is empty or not

    Returns Promise

isLocked

  • isLocked(key: K): Promise
  • Checks whether given key is locked.

    throws

    {RangeError} if key is null or undefined.

    Parameters

    • key: K

    Returns Promise

    true if key is locked, false otherwise

keySet

  • keySet(): Promise
  • Returns the keys of this map as an array.

    Returns Promise

keySetWithPredicate

  • keySetWithPredicate(predicate: Predicate): Promise
  • Queries the map based on the specified predicate and returns the keys of matching entries.

    Parameters

    Returns Promise

loadAll

  • loadAll(keys?: K[], replaceExistingValues?: boolean): Promise
  • Loads keys to the store.

    Parameters

    • Optional keys: K[]

      loads only given keys if set.

    • Optional replaceExistingValues: boolean

      if true existing keys will be replaced by newly loaded keys.

    Returns Promise

lock

  • lock(key: K, ttl?: number): Promise
  • Locks the given key for this map. Promise is resolved when lock is successfully acquired. This means it may never be resolved if some other process holds the lock and does not unlock it. A lock may be acquired on non-existent keys. Other processes wait on non-existent key. When this client puts the non-existent key, it is allowed to do that. Locks are re-entrant meaning that if lock is taken N times, it should be released N times.

    throws

    {RangeError} if key is null or undefined.

    Parameters

    • key: K
    • Optional ttl: number

      lock is automatically unlocked after ttl milliseconds.

    Returns Promise

put

  • put(key: K, value: V, ttl?: number): Promise
  • Associates the specified value with the specified key. If key was associated with another value, it replaces the old value. If specified, value is evicted after ttl seconds.

    throws

    {RangeError} if specified key or value is undefined or null or ttl is negative.

    Parameters

    • key: K
    • value: V
    • Optional ttl: number

      Time to live in milliseconds. 0 means infinite. If ttl is not an integer, it is rounded up to the nearest integer value.

    Returns Promise

    old value if there was any, undefined otherwise.

putAll

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

    Parameters

    • pairs: [K, V]

    Returns Promise

putIfAbsent

  • putIfAbsent(key: K, value: V, ttl?: number): Promise
  • Puts specified key value association if it was not present before.

    throws

    {RangeError} if key or value is null or undefined.

    Parameters

    • key: K
    • value: V
    • Optional ttl: number

      if set, key will be evicted automatically after ttl milliseconds.

    Returns Promise

    old value of the entry.

putTransient

  • putTransient(key: K, value: V, ttl?: number): Promise
  • Same as put except it does not call underlying MapStore.

    throws

    {RangeError} if key or value is null or undefined.

    Parameters

    • key: K
    • value: V
    • Optional ttl: number

    Returns Promise

remove

  • remove(key: K, value?: V): Promise
  • Removes specified key from map. If optional value is specified, the key is removed only if currently mapped to given value. Note that serialized version of value is used in comparison.

    throws

    {RangeError} if key is undefined or null

    Parameters

    • key: K
    • Optional value: V

    Returns Promise

    value associated with key, undefined if the key did not exist before.

removeEntryListener

  • removeEntryListener(listenerId: string): Promise
  • Removes a IMapListener from this map.

    Parameters

    • listenerId: string

      Registration Id of the listener.

    Returns Promise

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

replace

  • replace(key: K, newValue: V): Promise
  • Replaces value of given key with newValue.

    throws

    {RangeError} if key or newValue is null or undefined.

    Parameters

    • key: K
    • newValue: V

    Returns Promise

    previous value

replaceIfSame

  • replaceIfSame(key: K, oldValue: V, newValue: V): Promise
  • Replaces value of the key if only it was associated to oldValue.

    throws

    {RangeError} if key, oldValue or newValue is null or undefined.

    Parameters

    • key: K
    • oldValue: V
    • newValue: V

    Returns Promise

    true if the value was replaced.

set

  • set(key: K, value: V, ttl?: number): Promise
  • Similar to put except it does not return the old value.

    throws

    {RangeError} if key or value is null or undefined.

    Parameters

    • key: K
    • value: V
    • Optional ttl: number

    Returns Promise

size

  • size(): Promise
  • Retrieves the number of elements in map

    Returns Promise

    number of elements in map

tryLock

  • tryLock(key: K, timeout?: number, lease?: number): Promise
  • Tries to acquire the lock for the specified key. If lock is not available, server immediately responds with {false}

    throws

    {RangeError} if key is null or undefined.

    Parameters

    • key: K
    • Optional timeout: number

      Server waits for timeout milliseconds to acquire the lock before giving up.

    • Optional lease: number

      lock is automatically release after lease milliseconds.

    Returns Promise

tryPut

  • tryPut(key: K, value: V, timeout: number): Promise
  • Tries to put specified key value pair into map. If this method returns false, it indicates that caller thread was not able to acquire the lock for given key in timeout milliseconds.

    throws

    {RangeError} if key or value is null or undefined.

    Parameters

    • key: K
    • value: V
    • timeout: number

    Returns Promise

tryRemove

  • tryRemove(key: K, timeout: number): Promise
  • Tries to remove specified key from map. If this method returns false, it indicates that caller thread was not able to acquire the lock for given key in timeout milliseconds.

    throws

    {RangeError} if key is null or undefined.

    Parameters

    • key: K
    • timeout: number

    Returns Promise

unlock

  • unlock(key: K): Promise
  • Releases the lock for this key. If this client holds the lock, hold count is decremented. If hold count is zero, lock is released.

    throws

    {RangeError} if this client is not the owner of the key.

    Parameters

    • key: K

    Returns Promise

values

  • values(): Promise
  • Returns an array of values contained in this map.

    Returns Promise

valuesWithPredicate

  • valuesWithPredicate(predicate: Predicate): Promise
  • Queries the map based on the specified predicate and returns the values of matching entries. Specified predicate runs on all members in parallel.

    Parameters

    Returns Promise

Generated using TypeDoc