Search code examples
ruby-on-railsrubyherokuredisresque

Can you use Redis alongside Resque?


I'm using Redis To Go on Heroku, and I'd like to use it to store some data alongside Resque jobs, much like I can store DelayedJobs in the same Postgres database as the rest of my model data.

Is this possible? Care to explain briefly how Resque stores jobs in Redis? I'm new to Redis, and though I understand on a higher level how it works, I'm unfamiliar with the implementation details.


Solution

  • Yes, you can. According to the Resque documentation:

    Resque has a redis setter which can be given a string or a Redis object. This means if you're already using Redis in your app, Resque can re-use the existing connection.

    Also, the documentation for Resque.redis= states that a namespace is accepted, to prevent clashes with your other apps running on the same instance:

    A 'hostname:port/namespace' String (to set the Redis namespace)

    Check out the "Configuration" section of the Resque readme for more information: https://github.com/resque/resque/blob/master/README.markdown