# Redis Tasks
This module contains a collection of tasks for interacting with Redis via the redis-py library.
# RedisSet
class
prefect.tasks.redis.redis_tasks.RedisSet
(host="localhost", port=6379, db=0, password_secret="REDIS_PASSWORD", redis_key=None, redis_val=None, redis_connection_params=None, ex=None, px=None, nx=False, xx=False, **kwargs)[source]Task for setting a Redis key-value pair.
Args:
host (str, optional)
: name of Redis host, defaults to 'localhost'port (int, optional)
: Redis port, defaults to 6379db (int, optional)
: redis database index, defaults to 0password_secret (str, optional)
: the name of the Prefect Secret that stores your Redis credentialsredis_key (str, optional)
: Redis key to be set, can be provided at initialization or runtimeredis_val (Redis native type, optional)
: Redis val to be set, can be provided at initialization or runtime, Redis native types include strings, dictionaries, lists, sets, and sorted setsredis_connection_params (dict, optional)
: key-value pairs passed to the redis.Redis connection initializerex (int, optional)
: if provided, sets an expire flag, in seconds, on 'redis_key' setpx (int, optional)
: if provided, sets an expire flag, in milliseconds, on 'redis_key' setnx (int, optional)
: if set to True, set the value at 'redis_key' to 'redis_val' only if it does not exist, defaults to Falsexx (int, optional)
: if set to True, set the value at 'redis_key' to 'redis_val' only if it already exists, defaults to False**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.redis.redis_tasks.RedisSet.run (redis_key=None, redis_val=None, ex=None, px=None, nx=False, xx=False)[source] |
Task run method. Sets Redis key-value pair.
|
# RedisGet
class
prefect.tasks.redis.redis_tasks.RedisGet
(host="localhost", port=6379, db=0, password_secret="REDIS_PASSWORD", redis_connection_params=None, redis_key=None, **kwargs)[source]Task for getting a value based on key from a Redis connection.
Args:
host (str, optional)
: name of Redis host, defaults to 'localhost'port (int, optional)
: Redis port, defaults to 6379db (int, optional)
: redis database index, defaults to 0password_secret (str, optional)
: the name of the Prefect Secret that stores your Redis passwordredis_connection_params (dict, optional)
: key-value pairs passed to the redis.Redis connection initializerredis_key (str, optional)
: Redis key to get value, can be provided at initialization or runtime**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.redis.redis_tasks.RedisGet.run (redis_key=None)[source] |
Task run method.
|
# RedisExecute
class
prefect.tasks.redis.redis_tasks.RedisExecute
(host="localhost", port=6379, db=0, password_secret="REDIS_PASSWORD", redis_connection_params=None, redis_cmd=None, **kwargs)[source]Task for executing a command against a Redis connection
Args:
host (str, optional)
: name of Redis host, defaults to 'localhost'port (int, optional)
: Redis port, defaults to 6379db (int, optional)
: redis database index, defaults to 0password_secret (str, optional)
: the name of the Prefect Secret that stores your Redis credentialsredis_connection_params (dict, optional)
: key-value pairs passed to the redis.Redis connection initializerredis_cmd (str, optional)
: Redis command to execute, must be provided at initialization or runtime**kwargs (dict, optional)
: additional keyword arguments to pass to the Task constructor
methods: |
---|
prefect.tasks.redis.redis_tasks.RedisExecute.run (redis_cmd=None)[source] |
Task run method. Executes a command against a Redis connection.
|
This documentation was auto-generated from commit bd9182e
on July 31, 2024 at 18:02 UTC