redis_service.base
base
codex_platform.redis_service.base
Core Redis infrastructure components.
Contains: - catch_redis_errors — decorator that converts redis-py errors to domain exceptions - BaseRedisService — base class holding a Redis connection
Classes
BaseRedisService
Base class that holds a Redis connection.
Inherit from this class when building a service that wraps a Redis client
but does not need the full :class:~codex_platform.redis_service.service.RedisService
composition.
Source code in src/codex_platform/redis_service/base.py
Functions
__init__(client)
Initialize the service with an existing async Redis client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
Redis
|
An already-constructed |
required |
Functions
catch_redis_errors(func)
Decorator that converts redis-py exceptions into typed domain exceptions.
Never suppresses errors — always re-raises as a domain exception.
Preserves the original traceback via raise ... from e.
Catches
ConnectionError,TimeoutError→ :exc:RedisConnectionErrorRedisError→ :exc:RedisServiceError
Does NOT catch
JSONDecodeError, TypeError — data-specific errors are caught
in individual operations and re-raised as :exc:RedisDataError.
Source code in src/codex_platform/redis_service/base.py
catch_redis_errors_sync(func)
Decorator that converts redis-py exceptions into typed domain exceptions for sync functions.
Never suppresses errors — always re-raises as a domain exception.
Preserves the original traceback via raise ... from e.
Catches
ConnectionError,TimeoutError→ :exc:RedisConnectionErrorRedisError→ :exc:RedisServiceError
Does NOT catch
JSONDecodeError, TypeError — data-specific errors are caught
in individual operations and re-raised as :exc:RedisDataError.