Module spin_sdk.wit.imports.redis
Global variables
var Error-
Errors related to interacting with Redis
var RedisParameter-
A parameter type for the general-purpose
executefunction. var RedisResult-
A return type for the general-purpose
executefunction.
Classes
class Connection-
Expand source code
class Connection: @classmethod def open(cls, address: str) -> Self: """ Open a connection to the Redis instance at `address`. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)` """ raise NotImplementedError def publish(self, channel: str, payload: bytes) -> None: """ Publish a Redis message to the specified channel. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)` """ raise NotImplementedError def get(self, key: str) -> Optional[bytes]: """ Get the value of a key. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)` """ raise NotImplementedError def set(self, key: str, value: bytes) -> None: """ Set key to value. If key already holds a value, it is overwritten. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)` """ raise NotImplementedError def incr(self, key: str) -> int: """ Increments the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation. An `error::type-error` is returned if the key contains a value of the wrong type or contains a string that can not be represented as integer. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)` """ raise NotImplementedError def del_(self, keys: List[str]) -> int: """ Removes the specified keys. A key is ignored if it does not exist. Returns the number of keys deleted. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)` """ raise NotImplementedError def sadd(self, key: str, values: List[str]) -> int: """ Add the specified `values` to the set named `key`, returning the number of newly-added values. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)` """ raise NotImplementedError def smembers(self, key: str) -> List[str]: """ Retrieve the contents of the set named `key`. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)` """ raise NotImplementedError def srem(self, key: str, values: List[str]) -> int: """ Remove the specified `values` from the set named `key`, returning the number of newly-removed values. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)` """ raise NotImplementedError def execute(self, command: str, arguments: List[RedisParameter]) -> List[RedisResult]: """ Execute an arbitrary Redis command and receive the result. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)` """ raise NotImplementedError def __enter__(self) -> Self: """Returns self""" return self def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None: """ Release this resource. """ raise NotImplementedErrorStatic methods
def open(address: str) ‑> Self
Methods
def del_(self, keys: List[str]) ‑> int-
Expand source code
def del_(self, keys: List[str]) -> int: """ Removes the specified keys. A key is ignored if it does not exist. Returns the number of keys deleted. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)` """ raise NotImplementedError def execute(self,
command: str,
arguments: List[RedisParameter_Int64 | RedisParameter_Binary]) ‑> List[RedisResult_Nil | RedisResult_Status | RedisResult_Int64 | RedisResult_Binary]-
Expand source code
def execute(self, command: str, arguments: List[RedisParameter]) -> List[RedisResult]: """ Execute an arbitrary Redis command and receive the result. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)` """ raise NotImplementedError def get(self, key: str) ‑> bytes | None-
Expand source code
def get(self, key: str) -> Optional[bytes]: """ Get the value of a key. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)` """ raise NotImplementedError def incr(self, key: str) ‑> int-
Expand source code
def incr(self, key: str) -> int: """ Increments the number stored at key by one. If the key does not exist, it is set to 0 before performing the operation. An `error::type-error` is returned if the key contains a value of the wrong type or contains a string that can not be represented as integer. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)` """ raise NotImplementedError def publish(self, channel: str, payload: bytes) ‑> None-
Expand source code
def publish(self, channel: str, payload: bytes) -> None: """ Publish a Redis message to the specified channel. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)` """ raise NotImplementedError def sadd(self, key: str, values: List[str]) ‑> int-
Expand source code
def sadd(self, key: str, values: List[str]) -> int: """ Add the specified `values` to the set named `key`, returning the number of newly-added values. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)` """ raise NotImplementedError def set(self, key: str, value: bytes) ‑> None-
Expand source code
def set(self, key: str, value: bytes) -> None: """ Set key to value. If key already holds a value, it is overwritten. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)` """ raise NotImplementedError def smembers(self, key: str) ‑> List[str]-
Expand source code
def smembers(self, key: str) -> List[str]: """ Retrieve the contents of the set named `key`. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)` """ raise NotImplementedError def srem(self, key: str, values: List[str]) ‑> int-
Expand source code
def srem(self, key: str, values: List[str]) -> int: """ Remove the specified `values` from the set named `key`, returning the number of newly-removed values. Raises: `spin_sdk.wit.types.Err(spin_sdk.wit.imports.redis.Error)` """ raise NotImplementedError
class Error_InvalidAddress-
Expand source code
@dataclass class Error_InvalidAddress: passError_InvalidAddress()
class Error_Other (value: str)-
Expand source code
@dataclass class Error_Other: value: strError_Other(value: str)
Instance variables
var value : str
class Error_TooManyConnections-
Expand source code
@dataclass class Error_TooManyConnections: passError_TooManyConnections()
class Error_TypeError-
Expand source code
@dataclass class Error_TypeError: passError_TypeError()
class RedisParameter_Binary (value: bytes)-
Expand source code
@dataclass class RedisParameter_Binary: value: bytesRedisParameter_Binary(value: bytes)
Instance variables
var value : bytes
class RedisParameter_Int64 (value: int)-
Expand source code
@dataclass class RedisParameter_Int64: value: intRedisParameter_Int64(value: int)
Instance variables
var value : int
class RedisResult_Binary (value: bytes)-
Expand source code
@dataclass class RedisResult_Binary: value: bytesRedisResult_Binary(value: bytes)
Instance variables
var value : bytes
class RedisResult_Int64 (value: int)-
Expand source code
@dataclass class RedisResult_Int64: value: intRedisResult_Int64(value: int)
Instance variables
var value : int
class RedisResult_Nil-
Expand source code
@dataclass class RedisResult_Nil: passRedisResult_Nil()
class RedisResult_Status (value: str)-
Expand source code
@dataclass class RedisResult_Status: value: strRedisResult_Status(value: str)
Instance variables
var value : str