mirror of https://github.com/rq/rq.git
Add simple helper function, to avoid users to learn about the `conn`
stack. This makes it easier to start using the product.
This commit is contained in:
parent
0ff2984adf
commit
a491ff248d
|
@ -1,5 +1,13 @@
|
||||||
|
from redis import Redis
|
||||||
from .proxy import conn
|
from .proxy import conn
|
||||||
from .queue import Queue
|
from .queue import Queue
|
||||||
from .worker import Worker
|
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']
|
||||||
|
|
Loading…
Reference in New Issue