Redis
infra.adapters.redis
Summary
Redis-backed implementation of the report store port.
Persist and scan report payloads in Redis under the report:* key space.
Classes
RedisStoreAdaptor
Bases: ReportStore
Adapt a Redis client to the report store port.
Attributes:
| Name | Type | Description |
|---|---|---|
_redis |
Redis
|
Asynchronous Redis client bound to the configured URL. |
Initialize the adaptor with a Redis connection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url |
str
|
Redis connection URL. |
'redis://localhost:6379/0'
|
decode_responses |
bool
|
Whether Redis returns decoded strings. |
True
|
Functions
clear
async
Delete every report key from the store.
Notes
Scans REPORT_PREFIX and removes all matching keys in one call.
delete
async
Delete the value stored at key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key |
str
|
Redis key to remove. |
required |
get
async
Read the value stored at key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key |
str
|
Redis key to read. |
required |
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Optional[str]: Stored value, or |
scan
async
List keys matching pattern.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pattern |
str
|
Glob-style key pattern. |
required |
Returns:
| Type | Description |
|---|---|
List[str]
|
List[str]: Matching keys. |
set
async
Store value at key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key |
str
|
Redis key to write. |
required |
value |
str
|
Serialized value to persist. |
required |