seaworthy.containers.redis

Redis container definition.

class RedisContainer(name='redis', image='redis:alpine', wait_patterns=('\* Ready to accept connections', ), **kwargs)[source]

Redis container definition.

Todo

Write more docs.

base_kwargs()[source]

Add a tmpfs entry for /data to avoid unnecessary disk I/O.

clean()[source]

Remove all data by sending the FLUSHALL command.

exec_redis_cli(command, args=[], db=0, redis_cli_opts=[])[source]

Execute a redis-cli command inside a running container.

Parameters:
  • command – the command to run
  • args – a list of args for the command
  • db – the db number to query (default 0)
  • redis_cli_opts – a list of extra options to pass to redis-cli
Returns:

a tuple of the command exit code and output

list_keys(pattern='*', db=0)[source]

Run the KEYS command and return the list of matching keys.

Parameters:
  • pattern – the pattern to filter keys by (default *)
  • db – the db number to query (default 0)