diff --git a/rq/__init__.py b/rq/__init__.py index 07f3a396..ed309b30 100644 --- a/rq/__init__.py +++ b/rq/__init__.py @@ -1,5 +1,13 @@ +from redis import Redis from .proxy import conn from .queue import Queue from .worker import Worker -__all__ = ['conn', 'Queue', 'Worker'] +def use_redis(redis=None): + if redis is None: + redis = Redis() + elif not isinstance(redis, Redis): + raise TypeError('Argument redis should be a Redis instance.') + conn.push(redis) + +__all__ = ['conn', 'Queue', 'Worker', 'use_redis']