proxystore.connectors.redis¶
Redis connector implementation.
RedisKey
¶
Bases: NamedTuple
Key to objects store in a Redis server.
Attributes:
-
redis_key
(str
) –Unique object ID.
RedisConnector
¶
Redis server connector.
Parameters:
-
hostname
(str
) –Redis server hostname.
-
port
(int
) –Redis server port.
-
clear
(bool
, default:False
) –Remove all keys from the Redis server when
close()
is called. This will delete keys regardless of if they were created by ProxyStore or not.
Source code in proxystore/connectors/redis.py
close
¶
close(clear: bool | None = None) -> None
Close the connector and clean up.
Warning
Passing clear=True
will result in ALL keys in the Redis
server being deleted regardless of if they were created by
ProxyStore or not.
Parameters:
-
clear
(bool | None
, default:None
) –Remove all keys in the Redis server. Overrides the default value of
clear
provided when theRedisConnector
was instantiated.
Source code in proxystore/connectors/redis.py
config
¶
Get the connector configuration.
The configuration contains all the information needed to reconstruct the connector object.
Source code in proxystore/connectors/redis.py
from_config
classmethod
¶
from_config(config: dict[str, Any]) -> RedisConnector
Create a new connector instance from a configuration.
Parameters:
evict
¶
evict(key: RedisKey) -> None
Evict the object associated with the key.
Parameters:
-
key
(RedisKey
) –Key associated with object to evict.
exists
¶
get
¶
get_batch
¶
Get a batch of serialized objects associated with the keys.
Parameters:
Returns:
-
list[bytes | None]
–List with same order as
keys
with the serialized objects orNone
if the corresponding key does not have an associated object.
Source code in proxystore/connectors/redis.py
new_key
¶
Create a new key.
Parameters:
-
obj
(bytes | None
, default:None
) –Optional object which the key will be associated with. Ignored in this implementation.
Returns:
Source code in proxystore/connectors/redis.py
put
¶
put_batch
¶
Put a batch of serialized objects in the store.
Parameters:
Returns:
-
list[RedisKey]
–List of keys with the same order as
objs
which can be used to retrieve the objects.
Source code in proxystore/connectors/redis.py
set
¶
Set the object associated with a key.
Note
The Connector
provides write-once, read-many semantics. Thus,
set()
should only be called once per key, otherwise unexpected behavior
can occur.
Parameters:
-
key
(RedisKey
) –Key that the object will be associated with.
-
obj
(bytes
) –Object to associate with the key.