pyignite.api.key_value module¶
-
pyignite.api.key_value.
cache_clear
(connection: Connection, cache: Union[str, int], binary=False, query_id=None) → APIResult¶ Clears the cache without notifying listeners or cache writers.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- binary – (optional) pass True to keep the value in binary form. False by default,
- query_id – (optional) a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status on success, non-zero status and an error description otherwise.
-
pyignite.api.key_value.
cache_clear_key
(connection: Connection, cache: Union[str, int], key, key_hint: object = None, binary=False, query_id=None) → APIResult¶ Clears the cache key without notifying listeners or cache writers.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- key – key for the cache entry,
- key_hint – (optional) Ignite data type, for which the given key should be converted,
- binary – (optional) pass True to keep the value in binary form. False by default,
- query_id – (optional) a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status on success, non-zero status and an error description otherwise.
-
pyignite.api.key_value.
cache_clear_keys
(connection: Connection, cache: Union[str, int], keys: list, binary=False, query_id=None) → APIResult¶ Clears the cache keys without notifying listeners or cache writers.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- keys – list of keys or tuples of (key, key_hint),
- binary – (optional) pass True to keep the value in binary form. False by default,
- query_id – (optional) a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status on success, non-zero status and an error description otherwise.
-
pyignite.api.key_value.
cache_contains_key
(connection: Connection, cache: Union[str, int], key, key_hint=None, binary=False, query_id=None) → APIResult¶ Returns a value indicating whether given key is present in cache.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- key – key for the cache entry. Can be of any supported type,
- key_hint – (optional) Ignite data type, for which the given key should be converted,
- binary – pass True to keep the value in binary form. False by default,
- query_id – a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status and a bool value retrieved on success: True when key is present, False otherwise, non-zero status and an error description on failure.
-
pyignite.api.key_value.
cache_contains_keys
(connection: Connection, cache: Union[str, int], keys: Iterable[T_co], binary=False, query_id=None) → APIResult¶ Returns a value indicating whether all given keys are present in cache.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- keys – a list of keys or (key, type hint) tuples,
- binary – pass True to keep the value in binary form. False by default,
- query_id – a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status and a bool value retrieved on success: True when all keys are present, False otherwise, non-zero status and an error description on failure.
-
pyignite.api.key_value.
cache_get
(connection: Connection, cache: Union[str, int], key, key_hint=None, binary=False, query_id=None) → APIResult¶ Retrieves a value from cache by key.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- key – key for the cache entry. Can be of any supported type,
- key_hint – (optional) Ignite data type, for which the given key should be converted,
- binary – (optional) pass True to keep the value in binary form. False by default,
- query_id – (optional) a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status and a value retrieved on success, non-zero status and an error description on failure.
-
pyignite.api.key_value.
cache_get_all
(connection: Connection, cache: Union[str, int], keys: Iterable[T_co], binary=False, query_id=None) → APIResult¶ Retrieves multiple key-value pairs from cache.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- keys – list of keys or tuples of (key, key_hint),
- binary – (optional) pass True to keep the value in binary form. False by default,
- query_id – (optional) a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status and a dict, made of retrieved key-value pairs, non-zero status and an error description on failure.
-
pyignite.api.key_value.
cache_get_and_put
(connection: Connection, cache: Union[str, int], key, value, key_hint=None, value_hint=None, binary=False, query_id=None) → APIResult¶ Puts a value with a given key to cache, and returns the previous value for that key, or null value if there was not such key.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- key – key for the cache entry. Can be of any supported type,
- value – value for the key,
- key_hint – (optional) Ignite data type, for which the given key should be converted,
- value_hint – (optional) Ignite data type, for which the given value should be converted.
- binary – pass True to keep the value in binary form. False by default,
- query_id – a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status and an old value or None if a value is written, non-zero status and an error description in case of error.
-
pyignite.api.key_value.
cache_get_and_put_if_absent
(connection: Connection, cache: Union[str, int], key, value, key_hint=None, value_hint=None, binary=False, query_id=None) → APIResult¶ Puts a value with a given key to cache only if the key does not already exist.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- key – key for the cache entry. Can be of any supported type,
- value – value for the key,
- key_hint – (optional) Ignite data type, for which the given key should be converted,
- value_hint – (optional) Ignite data type, for which the given value should be converted.
- binary – (optional) pass True to keep the value in binary form. False by default,
- query_id – (optional) a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status and an old value or None on success, non-zero status and an error description otherwise.
-
pyignite.api.key_value.
cache_get_and_remove
(connection: Connection, cache: Union[str, int], key, key_hint=None, binary=False, query_id=None) → APIResult¶ Removes the cache entry with specified key, returning the value.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- key – key for the cache entry. Can be of any supported type,
- key_hint – (optional) Ignite data type, for which the given key should be converted,
- binary – pass True to keep the value in binary form. False by default,
- query_id – a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status and an old value or None, non-zero status and an error description otherwise.
-
pyignite.api.key_value.
cache_get_and_replace
(connection: Connection, cache: Union[str, int], key, value, key_hint=None, value_hint=None, binary=False, query_id=None) → APIResult¶ Puts a value with a given key to cache, returning previous value for that key, if and only if there is a value currently mapped for that key.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- key – key for the cache entry. Can be of any supported type,
- value – value for the key,
- key_hint – (optional) Ignite data type, for which the given key should be converted,
- value_hint – (optional) Ignite data type, for which the given value should be converted.
- binary – pass True to keep the value in binary form. False by default,
- query_id – a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status and an old value or None on success, non-zero status and an error description otherwise.
-
pyignite.api.key_value.
cache_get_size
(connection: Connection, cache: Union[str, int], peek_modes=0, binary=False, query_id=None) → APIResult¶ Gets the number of entries in cache.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- peek_modes – (optional) limit count to near cache partition (PeekModes.NEAR), primary cache (PeekModes.PRIMARY), or backup cache (PeekModes.BACKUP). Defaults to all cache partitions (PeekModes.ALL),
- binary – (optional) pass True to keep the value in binary form. False by default,
- query_id – (optional) a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status and a number of cache entries on success, non-zero status and an error description otherwise.
-
pyignite.api.key_value.
cache_put
(connection: Connection, cache: Union[str, int], key, value, key_hint=None, value_hint=None, binary=False, query_id=None) → APIResult¶ Puts a value with a given key to cache (overwriting existing value if any).
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- key – key for the cache entry. Can be of any supported type,
- value – value for the key,
- key_hint – (optional) Ignite data type, for which the given key should be converted,
- value_hint – (optional) Ignite data type, for which the given value should be converted.
- binary – (optional) pass True to keep the value in binary form. False by default,
- query_id – (optional) a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status if a value is written, non-zero status and an error description otherwise.
-
pyignite.api.key_value.
cache_put_all
(connection: Connection, cache: Union[str, int], pairs: dict, binary=False, query_id=None) → APIResult¶ Puts multiple key-value pairs to cache (overwriting existing associations if any).
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- pairs – dictionary type parameters, contains key-value pairs to save. Each key or value can be an item of representable Python type or a tuple of (item, hint),
- binary – (optional) pass True to keep the value in binary form. False by default,
- query_id – (optional) a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status if key-value pairs are written, non-zero status and an error description otherwise.
-
pyignite.api.key_value.
cache_put_if_absent
(connection: Connection, cache: Union[str, int], key, value, key_hint=None, value_hint=None, binary=False, query_id=None) → APIResult¶ Puts a value with a given key to cache only if the key does not already exist.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- key – key for the cache entry. Can be of any supported type,
- value – value for the key,
- key_hint – (optional) Ignite data type, for which the given key should be converted,
- value_hint – (optional) Ignite data type, for which the given value should be converted.
- binary – (optional) pass True to keep the value in binary form. False by default,
- query_id – (optional) a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status on success, non-zero status and an error description otherwise.
-
pyignite.api.key_value.
cache_remove_all
(connection: Connection, cache: Union[str, int], binary=False, query_id=None) → APIResult¶ Removes all entries from cache, notifying listeners and cache writers.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- binary – (optional) pass True to keep the value in binary form. False by default,
- query_id – (optional) a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status on success, non-zero status and an error description otherwise.
-
pyignite.api.key_value.
cache_remove_if_equals
(connection: Connection, cache: Union[str, int], key, sample, key_hint=None, sample_hint=None, binary=False, query_id=None) → APIResult¶ Removes an entry with a given key if provided value is equal to actual value, notifying listeners and cache writers.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- key – key for the cache entry,
- sample – a sample to compare the stored value with,
- key_hint – (optional) Ignite data type, for which the given key should be converted,
- sample_hint – (optional) Ignite data type, for whic the given sample should be converted
- binary – (optional) pass True to keep the value in binary form. False by default,
- query_id – (optional) a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status and a boolean success code, or non-zero status and an error description if something has gone wrong.
-
pyignite.api.key_value.
cache_remove_key
(connection: Connection, cache: Union[str, int], key, key_hint: object = None, binary=False, query_id=None) → APIResult¶ Clears the cache key without notifying listeners or cache writers.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- key – key for the cache entry,
- key_hint – (optional) Ignite data type, for which the given key should be converted,
- binary – (optional) pass True to keep the value in binary form. False by default,
- query_id – (optional) a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status and a boolean success code, or non-zero status and an error description if something has gone wrong.
-
pyignite.api.key_value.
cache_remove_keys
(connection: Connection, cache: Union[str, int], keys: Iterable[T_co], binary=False, query_id=None) → APIResult¶ Removes entries with given keys, notifying listeners and cache writers.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- keys – list of keys or tuples of (key, key_hint),
- binary – (optional) pass True to keep the value in binary form. False by default,
- query_id – (optional) a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status on success, non-zero status and an error description otherwise.
-
pyignite.api.key_value.
cache_replace
(connection: Connection, cache: Union[str, int], key, value, key_hint=None, value_hint=None, binary=False, query_id=None) → APIResult¶ Puts a value with a given key to cache only if the key already exist.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- key – key for the cache entry. Can be of any supported type,
- value – value for the key,
- key_hint – (optional) Ignite data type, for which the given key should be converted,
- value_hint – (optional) Ignite data type, for which the given value should be converted.
- binary – pass True to keep the value in binary form. False by default,
- query_id – a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status and a boolean success code, or non-zero status and an error description if something has gone wrong.
-
pyignite.api.key_value.
cache_replace_if_equals
(connection: Connection, cache: Union[str, int], key, sample, value, key_hint=None, sample_hint=None, value_hint=None, binary=False, query_id=None) → APIResult¶ Puts a value with a given key to cache only if the key already exists and value equals provided sample.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- key – key for the cache entry,
- sample – a sample to compare the stored value with,
- value – new value for the given key,
- key_hint – (optional) Ignite data type, for which the given key should be converted,
- sample_hint – (optional) Ignite data type, for whic the given sample should be converted
- value_hint – (optional) Ignite data type, for which the given value should be converted,
- binary – (optional) pass True to keep the value in binary form. False by default,
- query_id – (optional) a value generated by client and returned as-is in response.query_id. When the parameter is omitted, a random value is generated,
Returns: API result data object. Contains zero status and a boolean success code, or non-zero status and an error description if something has gone wrong.