Ruby & Redis: working with multiple databases

If you need to separate your data in multiple databases in redis:

Redis.new(:db => n) # where n is a numeric index

# examples
WORKERS_STORE = Redis.new(:db => 0)
CACHE_STORE = Redis.new(:db => 1)
TRANSLATIONS_STORE = Redis.new(:db => 2)

I’m using redis gem: https://rubygems.org/gems/redis

happy coding

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>