pyignite.api.cache_config module¶
Set of functions to manipulate caches.
Ignite cache can be viewed as a named entity designed to store key-value pairs. Each cache is split transparently between different Ignite partitions.
The choice of cache term is due to historical reasons. (Ignite initially had only non-persistent storage tier.)
-
pyignite.api.cache_config.
cache_create
(connection: Connection, name: str, query_id=None) → APIResult¶ Creates a cache with a given name. Returns error if a cache with specified name already exists.
Parameters: - connection – connection to Ignite server,
- name – cache name,
- 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 cache is created successfully, non-zero status and an error description otherwise.
-
pyignite.api.cache_config.
cache_create_with_config
(connection: Connection, cache_props: dict, query_id=None) → APIResult¶ Creates cache with provided configuration. An error is returned if the name is already in use.
Parameters: - connection – connection to Ignite server,
- cache_props – cache configuration properties to create cache with in form of dictionary {property code: python value}. You must supply at least name (PROP_NAME),
- 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 cache was created, non-zero status and an error description otherwise.
-
pyignite.api.cache_config.
cache_destroy
(connection: Connection, cache: Union[str, int], query_id=None) → APIResult¶ Destroys cache with a given name.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- 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.
-
pyignite.api.cache_config.
cache_get_configuration
(connection: Connection, cache: Union[str, int], flags: int = 0, query_id=None) → APIResult¶ Gets configuration for the given cache.
Parameters: - connection – connection to Ignite server,
- cache – name or ID of the cache,
- flags – Ignite documentation is unclear on this subject,
- 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. Result value is OrderedDict with the cache configuration parameters.
-
pyignite.api.cache_config.
cache_get_names
(connection: Connection, query_id=None) → APIResult¶ Gets existing cache names.
Parameters: - connection – connection to Ignite server,
- 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 list of cache names, non-zero status and an error description otherwise.
-
pyignite.api.cache_config.
cache_get_or_create
(connection: Connection, name: str, query_id=None) → APIResult¶ Creates a cache with a given name. Does nothing if the cache exists.
Parameters: - connection – connection to Ignite server,
- name – cache name,
- 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 cache is created successfully, non-zero status and an error description otherwise.
-
pyignite.api.cache_config.
cache_get_or_create_with_config
(connection: Connection, cache_props: dict, query_id=None) → APIResult¶ Creates cache with provided configuration. Does nothing if the name is already in use.
Parameters: - connection – connection to Ignite server,
- cache_props – cache configuration properties to create cache with in form of dictionary {property code: python value}. You must supply at least name (PROP_NAME),
- 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 cache was created, non-zero status and an error description otherwise.
-
pyignite.api.cache_config.
compact_cache_config
(cache_config: dict) → dict¶ This is to make cache config read/write-symmetrical.
Parameters: cache_config – dict of cache config properties, like {‘is_onheapcache_enabled’: 1}, Returns: the same dict, but with property codes as keys, like {PROP_IS_ONHEAPCACHE_ENABLED: 1}.