Result

Attributes
Methods
class zcached.Result(raw_value, error=None)[source]

Bases: Generic[T]

Represents the result of the server response.

Parameters:
  • raw_value (bytes) – A raw value to deserialize.

  • error (str | None) – Error message detailing why the operation failed.

value

Operation result. Stores empty bytes if the operation fails.

error

Error message detailing why the operation failed, value is None if operation was successful.

classmethod fail(error)[source]

Create a Result object for a failed operation.

Parameters:

error (str)

property failure: bool

True if operation failed.

is_empty()[source]

Checks if the value is empty.

Return type:

bool

classmethod ok(raw_value)[source]

Create a Result object for a successful operation.

Parameters:

raw_value (bytes)

property success: bool

True if the operation was successful.