Skip to content

Redis repository

The default repository. It is the simplest to set up, and has some limits you should know about:

  • All the events live in a single Redis hash, event-audit, and the fields of an event are packed into the hash key.
  • Every read, whatever the filter, scans the whole hash: filtering by fields uses a glob match on the keys, and filtering by time or by payload/result is done in Python after the events have been decoded. The cost grows with the number of events.
  • Nothing expires the events. Use the retention command to remove the old ones.
  • Whether the events survive a Redis restart depends on your Redis persistence configuration.

For a log that you keep and query, prefer the Postgres repository.

filter_events(filters)

Filters events based on patterns generated from the provided filters.

PARAMETER DESCRIPTION
filters

filters to apply.

TYPE: Filters

get_event(event_id)

Get an event by its ID.

PARAMETER DESCRIPTION
event_id

event ID.

TYPE: float

remove_all_events()

Removes all events from the repository.

RETURNS DESCRIPTION
Result

types.Result: result of the operation.

remove_event(event_id)

Removes an event by its ID.

PARAMETER DESCRIPTION
event_id

event ID.

TYPE: float

RETURNS DESCRIPTION
Result

types.Result: result of the operation.

remove_events(filters)

Removes a filtered set of events from the repository.

PARAMETER DESCRIPTION
filters

filters to apply.

TYPE: Filters

RETURNS DESCRIPTION
Result

types.Result: result of the operation.

test_connection()

Tests the connection to the repository.

RETURNS DESCRIPTION
bool

whether the connection was successful.

TYPE: bool

write_event(event)

Writes an event to Redis.

PARAMETER DESCRIPTION
event

event to write.

TYPE: Event

RETURNS DESCRIPTION
Result

types.Result: result of the operation.