I’m not understanding how to make a persistent store in Redis. Using the options hash is the only place I saw to pass in a path, and it doesn’t seem to have any effect.
> r = Redis.new({:options => {:path => '~/redis_store'}})
=> #<Redis client v2.2.0 connected to redis://127.0.0.1:6379/0 (Redis v2.9.0)>
> r['foo']
=> "bar"
> s = Redis.new({:options => {:path => '~/redis_store2'}})
=> #<Redis client v2.2.0 connected to redis://127.0.0.1:6379/0 (Redis v2.9.0)>
> s['foo']
=> "bar"
Redis is already a persistent store, and the
:pathoption you found is to designate a unix socket to use to talk to the running Redis server in lieu of a TCP connection (supported in Redis 2.2), not to designate an actual database file.Are you trying to be able to have isolated databases, so that when you set
r['foo'] = 'bar',s['foo']still returnsnil?If so, Redis lets you connect to multiple numbered databases, the default being #0 (this is what the
/0is inconnected to redis://127.0.0.1:6379/0). To choose a different database: