Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IMap<K, V>

Type parameters

  • K

  • V

Hierarchy

Implemented by

Index

Methods

addEntryListener

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

    Parameters

    • listener: MapListener<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<string>

    Registration id of the listener.

addEntryListenerWithPredicate

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

    Parameters

    • listener: MapListener<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<string>

    Registration id of the listener.

addIndex

  • addIndex(attribute: string, ordered: boolean): Promise<void>
  • 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<void>

aggregate

  • aggregate<R>(aggregator: Aggregator<R>): Promise<R>
  • Applies the aggregation logic on all map entries and returns the result

    Fast-Aggregations are the successor of the Map-Reduce Aggregators. They are equivalent to the Map-Reduce Aggregators in most of the use-cases, but instead of running on the Map-Reduce engine they run on the Query infrastructure. Their performance is tens to hundreds times better due to the fact that they run in parallel for each partition and are highly optimized for speed and low memory consumption.

    requires

    Hazelcast 3.8

    Type parameters

    • R

      type of the result

    Parameters

    • aggregator: Aggregator<R>

      aggregator to aggregate the entries with

    Returns Promise<R>

    the result of the given type

aggregateWithPredicate

  • Applies the aggregation logic on map entries filtered with the Predicated and returns the result

    Fast-Aggregations are the successor of the Map-Reduce Aggregators. They are equivalent to the Map-Reduce Aggregators in most of the use-cases, but instead of running on the Map-Reduce engine they run on the Query infrastructure. Their performance is tens to hundreds times better due to the fact that they run in parallel for each partition and are highly optimized for speed and low memory consumption.

    requires

    Hazelcast 3.8

    Type parameters

    • R

      type of the result

    Parameters

    • aggregator: Aggregator<R>

      aggregator to aggregate the entries with

    • predicate: Predicate

      predicate to filter the entries with

    Returns Promise<R>

    the result of the given type

clear

  • clear(): Promise<void>

containsKey

  • containsKey(key: K): Promise<boolean>
  • 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<boolean>

    true if the map contains the key, false otherwise.

containsValue

  • containsValue(value: V): Promise<boolean>
  • 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<boolean>

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

delete

  • delete(key: K): Promise<void>
  • 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<void>

destroy

  • destroy(): Promise<void>

entrySet

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

    Returns Promise<Array<[K, V]>>

entrySetWithPredicate

  • entrySetWithPredicate(predicate: Predicate): Promise<Array<[K, V]>>
  • 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<Array<[K, V]>>

    result entry set of the query.

evict

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

    throws

    {RangeError} if key is null or undefined.

    Parameters

    • key: K

    Returns Promise<boolean>

evictAll

  • evictAll(): Promise<void>

executeOnEntries

  • Applies the user defined EntryProcessor to the all entries in the map. Returns the results mapped by each key in the map Note that {entryProcessor} should be registered at server side too.

    Parameters

    Returns Promise<Array<[K, V]>>

    entries after entryprocessor is applied.

executeOnKey

  • Applies the user defined EntryProcessor to the entry mapped by the key.

    Parameters

    Returns Promise<V>

    result of entry process.

executeOnKeys

  • Applies the user defined EntryProcessor to the entries mapped by the given keys.

    Parameters

    Returns Promise<Array<[K, V]>>

    result of entry process

flush

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

    Returns Promise<void>

forceUnlock

  • forceUnlock(key: K): Promise<void>
  • 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<void>

get

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

    throws

    {RangeError} if key is undefined or null

    Parameters

    • key: K

    Returns Promise<V>

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

getAll

  • getAll(keys: K[]): Promise<Array<[K, V]>>
  • Retrieves key value pairs of given keys.

    Parameters

    • keys: K[]

      the array of keys

    Returns Promise<Array<[K, V]>>

getEntryView

  • getEntryView(key: K): Promise<EntryView<K, V>>
  • Returns a key-value pair representing the association of given key

    throws

    {RangeError} if key is null or undefined.

    Parameters

    • key: K

    Returns Promise<EntryView<K, V>>

getName

  • getName(): string

getPartitionKey

  • getPartitionKey(): string

getServiceName

  • getServiceName(): string

isEmpty

  • isEmpty(): Promise<boolean>
  • Returns whether this map is empty or not

    Returns Promise<boolean>

isLocked

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

    throws

    {RangeError} if key is null or undefined.

    Parameters

    • key: K

    Returns Promise<boolean>

    true if key is locked, false otherwise

keySet

  • keySet(): Promise<K[]>
  • Returns the keys of this map as an array.

    Returns Promise<K[]>

keySetWithPredicate

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

    Parameters

    Returns Promise<K[]>

loadAll

  • loadAll(keys?: K[], replaceExistingValues?: boolean): Promise<void>
  • 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<void>

lock

  • lock(key: K, ttl?: number): Promise<void>
  • 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<void>

put

  • put(key: K, value: V, ttl?: number): Promise<V>
  • 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<V>

    old value if there was any, undefined otherwise.

putAll

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

    Parameters

    • pairs: Array<[K, V]>

    Returns Promise<void>

putIfAbsent

  • putIfAbsent(key: K, value: V, ttl?: number): Promise<V>
  • 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<V>

    old value of the entry.

putTransient

  • putTransient(key: K, value: V, ttl?: number): Promise<void>
  • 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<void>

remove

  • remove(key: K, value?: V): Promise<V>
  • 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<V>

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

removeEntryListener

  • removeEntryListener(listenerId: string): Promise<boolean>
  • Removes a MapListener from this map.

    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.

replace

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

    throws

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

    Parameters

    • key: K
    • newValue: V

    Returns Promise<V>

    previous value

replaceIfSame

  • replaceIfSame(key: K, oldValue: V, newValue: V): Promise<boolean>
  • 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<boolean>

    true if the value was replaced.

set

  • set(key: K, value: V, ttl?: number): Promise<void>
  • 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<void>

size

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

    Returns Promise<number>

    number of elements in map

tryLock

  • tryLock(key: K, timeout?: number, lease?: number): Promise<boolean>
  • 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<boolean>

tryPut

  • tryPut(key: K, value: V, timeout: number): Promise<boolean>
  • 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<boolean>

tryRemove

  • tryRemove(key: K, timeout: number): Promise<boolean>
  • 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<boolean>

unlock

  • unlock(key: K): Promise<void>
  • 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<void>

values

valuesWithPredicate

  • 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<ReadOnlyLazyList<V>>

    a list of values that satisfies the given predicate.

Generated using TypeDoc