lmcache.storage_backend.connector package#
Submodules#
lmcache.storage_backend.connector.base_connector module#
- class lmcache.storage_backend.connector.base_connector.RemoteConnector[source]#
Interface for remote connector
- abstract exists(key: str) bool [source]#
Check if the remote server contains the key
- Input:
key: a string
- Returns:
True if the cache engine contains the key, False otherwise
- abstract get(key: str) bytes | None [source]#
Get the objects (bytes) of the corresponding key
- Input:
key: the key of the corresponding object
- Returns:
The object (bytes) of the corresponding key Return None if the key does not exist
- class lmcache.storage_backend.connector.base_connector.RemoteConnectorDebugWrapper(connector: RemoteConnector)[source]#
Bases:
RemoteConnector
- exists(key: str) bool [source]#
Check if the remote server contains the key
- Input:
key: a string
- Returns:
True if the cache engine contains the key, False otherwise
- get(key: str) bytes | None [source]#
Get the objects (bytes) of the corresponding key
- Input:
key: the key of the corresponding object
- Returns:
The object (bytes) of the corresponding key Return None if the key does not exist
lmcache.storage_backend.connector.lm_connector module#
- class lmcache.storage_backend.connector.lm_connector.LMCServerConnector(host, port)[source]#
Bases:
RemoteConnector
- exists(key: str) bool [source]#
Check if the remote server contains the key
- Input:
key: a string
- Returns:
True if the cache engine contains the key, False otherwise
- get(key: str) bytes | None [source]#
Get the objects (bytes) of the corresponding key
- Input:
key: the key of the corresponding object
- Returns:
The object (bytes) of the corresponding key Return None if the key does not exist
lmcache.storage_backend.connector.redis_connector module#
- class lmcache.storage_backend.connector.redis_connector.RedisConnector(host: str, port: int)[source]#
Bases:
RemoteConnector
The remote url should start with “redis://” and only have one host-port pair
- exists(key: str) bool [source]#
Check if the remote server contains the key
- Input:
key: a string
- Returns:
True if the cache engine contains the key, False otherwise
- class lmcache.storage_backend.connector.redis_connector.RedisSentinelConnector(hosts_and_ports: List[Tuple[str, str | int]])[source]#
Bases:
RemoteConnector
Uses redis.Sentinel to connect to a Redis cluster. The hosts are specified in the config file, started with “redis-sentinel://” and separated by commas.
Example
remote_url: “redis-sentinel://localhost:26379,localhost:26380,localhost:26381”
Extra environment variables: - REDIS_SERVICE_NAME (required) – service name for redis. - REDIS_TIMEOUT (optional) – Timeout in seconds, default is 1 if not set
- ENV_REDIS_SERVICE_NAME = 'REDIS_SERVICE_NAME'#
- ENV_REDIS_TIMEOUT = 'REDIS_TIMEOUT'#
- exists(key: str) bool [source]#
Check if the remote server contains the key
- Input:
key: a string
- Returns:
True if the cache engine contains the key, False otherwise