Skip Menu |

This queue is for tickets about the CHI-Driver-Redis CPAN distribution.

Report information
The Basics
Id: 101771
Status: open
Priority: 0/
Queue: CHI-Driver-Redis

People
Owner: ianburrell [...] gmail.com
Requestors: JKRAMER [...] cpan.org
Cc: gortan [...] cpan.org
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: 0.10



Subject: Index not configurable
Please allow configuration of redis database index (currently it always uses the redis default, index 0).
Hey there! I don't know what you mean by this request. Can you elaborate a bit? Thanks! On Tue Jan 27 10:47:11 2015, jkramer wrote: Show quoted text
> Please allow configuration of redis database index (currently it > always uses the redis default, index 0).
Hi! A redis instance can have multiple databases (16 by default, index 0..15), so you can separate data from different applications in different databases (or however you want to organize your data). By default, database 0 is used. In case database 0 is already used for something, it would be nice being able to configure the index to use in CHI::Driver::Redis, so cache data isn't mixed with application data. The redis command to switch databases is SELECT (http://redis.io/commands/SELECT). Best place to do this is in the on_connect hook, so it gets automatically applied to new connections, like this: $r->on_connect( my ($r) = @_; $r->select($config->{index} // 0); ); $r->connect(...) Best regards, Jonas On Mon Feb 02 19:51:32 2015, GPHAT wrote: Show quoted text
> Hey there! > > I don't know what you mean by this request. Can you elaborate a bit? Thanks! > > On Tue Jan 27 10:47:11 2015, jkramer wrote:
> > Please allow configuration of redis database index (currently it > > always uses the redis default, index 0).
> >
I'm thinking of allowing passing any options to the Redis constructor. That way don't have to explicitly add support "on_connect". Or have special support for "index". Possibilities are: "redis" parameter for Redis object. "redis_options" parameters for hash of options passed to Redis constructor. Pass all non-CHI options to the Redis constructor. On Tue Feb 03 04:03:18 2015, jkramer wrote: Show quoted text
> Hi! > > A redis instance can have multiple databases (16 by default, index > 0..15), so you can separate data from different applications in > different databases (or however you want to organize your data). By > default, database 0 is used. In case database 0 is already used for > something, it would be nice being able to configure the index to use > in CHI::Driver::Redis, so cache data isn't mixed with application > data. The redis command to switch databases is SELECT > (http://redis.io/commands/SELECT). Best place to do this is in the > on_connect hook, so it gets automatically applied to new connections, > like this: > > $r->on_connect( > my ($r) = @_; > $r->select($config->{index} // 0); > ); > $r->connect(...) > > Best regards, > Jonas > > On Mon Feb 02 19:51:32 2015, GPHAT wrote:
> > Hey there! > > > > I don't know what you mean by this request. Can you elaborate a bit? > > Thanks! > > > > On Tue Jan 27 10:47:11 2015, jkramer wrote:
> > > Please allow configuration of redis database index (currently it > > > always uses the redis default, index 0).
> > > >
I just uploaded CHI::Driver::Redis 0.09 with the ability to pass abitrary Redis options to the CHI::Driver::Redis, either in "redis_options" parameter, as extra parameters, or to pass a constructed Redis object ("redis" param). Should be able to implement "on_connect" support for indexes. On Wed Feb 18 16:55:59 2015, ianburrell@gmail.com wrote: Show quoted text
> I'm thinking of allowing passing any options to the Redis constructor. > That way don't have to explicitly add support "on_connect". Or have > special support for "index". Possibilities are: > > "redis" parameter for Redis object. > > "redis_options" parameters for hash of options passed to Redis > constructor. > > Pass all non-CHI options to the Redis constructor. > > On Tue Feb 03 04:03:18 2015, jkramer wrote:
> > Hi! > > > > A redis instance can have multiple databases (16 by default, index > > 0..15), so you can separate data from different applications in > > different databases (or however you want to organize your data). By > > default, database 0 is used. In case database 0 is already used for > > something, it would be nice being able to configure the index to use > > in CHI::Driver::Redis, so cache data isn't mixed with application > > data. The redis command to switch databases is SELECT > > (http://redis.io/commands/SELECT). Best place to do this is in the > > on_connect hook, so it gets automatically applied to new connections, > > like this: > > > > $r->on_connect( > > my ($r) = @_; > > $r->select($config->{index} // 0); > > ); > > $r->connect(...) > > > > Best regards, > > Jonas > > > > On Mon Feb 02 19:51:32 2015, GPHAT wrote:
> > > Hey there! > > > > > > I don't know what you mean by this request. Can you elaborate a > > > bit? > > > Thanks! > > > > > > On Tue Jan 27 10:47:11 2015, jkramer wrote:
> > > > Please allow configuration of redis database index (currently it > > > > always uses the redis default, index 0).
> > > > > >
On Tue Feb 24 18:09:43 2015, ianburrell@gmail.com wrote: Show quoted text
> Should be able to implement "on_connect" support for indexes.
I can confirm that using on_connect, it is now possible to select the DB index. IMHO this issue can be closed.