Skip to content

proxystore.store.redis

RedisStore Implementation.

RedisStoreKey

Bases: NamedTuple

Key to objects in a RedisStore.

redis_key class-attribute

redis_key: str

Unique object ID.

RedisStore

RedisStore(
    name: str,
    *,
    hostname: str,
    port: int,
    cache_size: int = 16,
    stats: bool = False
) -> None

Bases: Store[RedisStoreKey]

Redis backend class.

Parameters:

  • name (str) –

    Name of the store instance.

  • hostname (str) –

    Redis server hostname.

  • port (int) –

    Redis server port.

  • cache_size (int) –

    Size of LRU cache (in # of objects). If 0, the cache is disabled. The cache is local to the Python process.

  • stats (bool) –

    Collect stats on store operations.

Source code in proxystore/store/redis.py
def __init__(
    self,
    name: str,
    *,
    hostname: str,
    port: int,
    cache_size: int = 16,
    stats: bool = False,
) -> None:
    self.hostname = hostname
    self.port = port
    self._redis_client = redis.StrictRedis(host=hostname, port=port)
    super().__init__(
        name,
        cache_size=cache_size,
        stats=stats,
        kwargs={'hostname': self.hostname, 'port': self.port},
    )