-
Notifications
You must be signed in to change notification settings - Fork 0
ray_plasma_kv_store
Sanjay Kumar Srikakulam edited this page Apr 6, 2022
·
1 revision
-
Ray's plasma KV store using actors offers the following functionality:
- Shared memory based storage
- Python dictionary like interface
- Not multi-process safe (Use only single reader, and writer process)
-
Methods
- setitem
- getitem
- delitem
- contains
- iter
- len
- keys
- values
- get_multi
- set_multi
- close
-
Open Python terminal from the conda environment
# Activate conda env
conda activate pykvstores
# Open Python terminal
python
Examples
# Import the RayKVStore class
>>> from pykvstores.ray_kvstore import RayKVStore
# Create a RayKVStore object (pass the max number of processes you want to use)
>>> store = RayKVStore(ncpus=2)
# Set an item
>>> store['key'] = 'value'
# Get an item
>>> store['key']
'value'
# Set multiple items
>>> store.set_multi(['key1', 'key2'], ['value1', 'value2'])
# Get multiple items
>>> store.get_multi(['key1', 'key2'])
['value1', 'value2']
# Cleanup and close the store
>>> store.close()
# For more details
>>> help(RayKVStore)