- Source:
Members
(static, readonly) PEEK_MODE
Peek modes
Properties:
Name | Type | Description |
---|---|---|
ALL |
0 |
|
NEAR |
1 |
|
PRIMARY |
2 |
|
BACKUP |
3 |
- Source:
Methods
(async) clear()
Removes all entries from the cache, without notifying listeners and cache writers.
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
(async) clearKey(key)
Removes entry with the specified key from the cache, without notifying listeners and cache writers.
Parameters:
Name | Type | Description |
---|---|---|
key |
* | key to be removed. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
(async) clearKeys(keys)
Removes entries with the specified keys from the cache, without notifying listeners and cache writers.
Parameters:
Name | Type | Description |
---|---|---|
keys |
Array.<*> | keys to be removed. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
(async) containsKey(key) → {Promise.<boolean>}
Checks if the specified key exists in the cache.
Parameters:
Name | Type | Description |
---|---|---|
key |
* | key to check. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- true if the key exists, false otherwise.
- Type
- Promise.<boolean>
(async) containsKeys(keys) → {Promise.<boolean>}
Checks if all the specified keys exist in the cache.
Parameters:
Name | Type | Description |
---|---|---|
keys |
Array.<*> | keys to check. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- true if all the keys exist, false if at least one of the keys does not exist in the cache.
- Type
- Promise.<boolean>
(async) get(key) → {Promise.<*>}
Retrieves a value associated with the specified key from the cache.
Parameters:
Name | Type | Description |
---|---|---|
key |
* | key. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- value associated with the specified key, or null if it does not exist.
- Type
- Promise.<*>
(async) getAll(keys) → {Promise.<Array.<CacheEntry>>}
Retrieves entries associated with the specified keys from the cache.
Parameters:
Name | Type | Description |
---|---|---|
keys |
Array.<*> | keys. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- the retrieved entries (key-value pairs). Entries with the keys which do not exist in the cache are not included into the array.
- Type
- Promise.<Array.<CacheEntry>>
(async) getAndPut(key, value) → {Promise.<*>}
Associates the specified value with the specified key in the cache and returns the previous associated value, if any.
Overwrites the previous value if the key exists in the cache, otherwise creates new entry (key-value pair).
Parameters:
Name | Type | Description |
---|---|---|
key |
* | key. |
value |
* | value to be associated with the specified key. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- the previous value associated with the specified key, or null if it did not exist.
- Type
- Promise.<*>
(async) getAndPutIfAbsent(key, value) → {Promise.<*>}
Creates new entry (key-value pair) if the specified key does not exist in the cache. Otherwise returns the current value associated with the existing key.
Parameters:
Name | Type | Description |
---|---|---|
key |
* | key. |
value |
* | value to be associated with the specified key. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- the current value associated with the key if it already exists in the cache, null if the new entry is created.
- Type
- Promise.<*>
(async) getAndRemove(key) → {Promise.<*>}
Removes the cache entry with the specified key and returns the last associated value, if any.
Parameters:
Name | Type | Description |
---|---|---|
key |
* | key of the entry to be removed. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- the last value associated with the specified key, or null if it did not exist.
- Type
- Promise.<*>
(async) getAndReplace(key, value) → {Promise.<*>}
Associates the specified value with the specified key in the cache and returns the previous associated value, if the key exists in the cache. Otherwise does nothing and returns null.
Parameters:
Name | Type | Description |
---|---|---|
key |
* | key. |
value |
* | value to be associated with the specified key. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- the previous value associated with the specified key, or null if it did not exist.
- Type
- Promise.<*>
(async) getSize(…peekModesopt) → {Promise.<number>}
Returns the number of the entries in the cache.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
peekModes |
CacheClient.PEEK_MODE |
<optional> <repeatable> |
peek modes. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- the number of the entries in the cache.
- Type
- Promise.<number>
(async) put(key, value)
Associates the specified value with the specified key in the cache.
Overwrites the previous value if the key exists in the cache, otherwise creates new entry (key-value pair).
Parameters:
Name | Type | Description |
---|---|---|
key |
* | key. |
value |
* | value to be associated with the specified key. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
(async) putAll(entries)
Associates the specified values with the specified keys in the cache.
Overwrites the previous value if a key exists in the cache, otherwise creates new entry (key-value pair).
Parameters:
Name | Type | Description |
---|---|---|
entries |
Array.<CacheEntry> | entries (key-value pairs) to be put into the cache. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
(async) putIfAbsent(key, value) → {Promise.<boolean>}
Creates new entry (key-value pair) if the specified key does not exist in the cache. Otherwise does nothing.
Parameters:
Name | Type | Description |
---|---|---|
key |
* | key. |
value |
* | value to be associated with the specified key. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- true if the operation has been done, false otherwise.
- Type
- Promise.<boolean>
(async) query(query) → {Promise.<Cursor>}
Starts an SQL or Scan query operation.
Parameters:
Name | Type | Description |
---|---|---|
query |
SqlQuery | SqlFieldsQuery | ScanQuery | query to be executed. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- cursor to obtain the results of the query operation:
- SqlFieldsCursor in case of SqlFieldsQuery query
- Cursor in case of other types of query
- Type
- Promise.<Cursor>
(async) removeAll()
Removes all entries from the cache, notifying listeners and cache writers.
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
(async) removeIfEquals(key, value) → {Promise.<boolean>}
Removes entry with the specified key from the cache, if the current value equals to the provided one. Notifies listeners and cache writers.
Parameters:
Name | Type | Description |
---|---|---|
key |
* | key to be removed. |
value |
* | value to be compared with the current value associated with the specified key. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- true if the operation has been done, false otherwise.
- Type
- Promise.<boolean>
(async) removeKey(key) → {Promise.<boolean>}
Removes entry with the specified key from the cache, notifying listeners and cache writers.
Parameters:
Name | Type | Description |
---|---|---|
key |
* | key to be removed. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- true if the operation has been done, false otherwise.
- Type
- Promise.<boolean>
(async) removeKeys(keys)
Removes entries with the specified keys from the cache, notifying listeners and cache writers.
Parameters:
Name | Type | Description |
---|---|---|
keys |
Array.<*> | keys to be removed. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
(async) replace(key, value) → {Promise.<boolean>}
Associates the specified value with the specified key, if the key exists in the cache. Otherwise does nothing.
Parameters:
Name | Type | Description |
---|---|---|
key |
* | key. |
value |
* | value to be associated with the specified key. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- true if the operation has been done, false otherwise.
- Type
- Promise.<boolean>
(async) replaceIfEquals(key, value, newValue) → {Promise.<boolean>}
Associates the new value with the specified key, if the key exists in the cache and the current value equals to the provided one. Otherwise does nothing.
Parameters:
Name | Type | Description |
---|---|---|
key |
* | key. |
value |
* | value to be compared with the current value associated with the specified key. |
newValue |
* | new value to be associated with the specified key. |
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- true if the operation has been done, false otherwise.
- Type
- Promise.<boolean>
setKeyType(type) → {CacheClient}
Specifies a type of the cache key.
The cache client assumes that keys in all further operations with the cache will have the specified type. Eg. the cache client will convert keys provided as input parameters of the methods to the specified object type before sending them to a server.
After the cache client creation a type of the cache key is not specified (null).
If the type is not specified then during operations the cache client will do automatic mapping between some of the JavaScript types and object types - according to the mapping table defined in the description of the ObjectType class.
Parameters:
Name | Type | Description |
---|---|---|
type |
ObjectType.PRIMITIVE_TYPE | CompositeType | type of the keys in the cache:
|
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- the same instance of the cache client.
- Type
- CacheClient
setValueType(type) → {CacheClient}
Specifies a type of the cache value.
The cache client assumes that values in all further operations with the cache will have the specified type. Eg. the cache client will convert values provided as input parameters of the methods to the specified object type before sending them to a server.
After the cache client creation a type of the cache value is not specified (null).
If the type is not specified then during operations the cache client will do automatic mapping between some of the JavaScript types and object types - according to the mapping table defined in the description of the ObjectType class.
Parameters:
Name | Type | Description |
---|---|---|
type |
ObjectType.PRIMITIVE_TYPE | CompositeType | type of the values in the cache:
|
- Source:
Throws:
-
if error.
- Type
- IgniteClientError
Returns:
- the same instance of the cache client.
- Type
- CacheClient