[Mojolicious] Re: Need help (feedback) with Mojo::Redis2 - A new pure-perl non-blocking I/O Redis driver

2014-10-04 Thread Jan Henning Thorsen
This makes a new connection on each request: helper redis => sub { shift->stash->{redis} ||= Mojo::Redis2->new(url => $redis_server)}; On Saturday, October 4, 2014 2:46:56 AM UTC+2, Daniel Mantovani wrote: > > I was trying to handle several subscribe channels with only one redis > client using

[Mojolicious] Re: Need help (feedback) with Mojo::Redis2 - A new pure-perl non-blocking I/O Redis driver

2014-10-03 Thread Daniel Mantovani
I was trying to handle several subscribe channels with only one redis client using Mojo::Redis2, but it seems that I'm doing something wrong, I end up using as many clients as open subscribed channels I have. Maybe somebody can take a look at this test code and let me know : https://github.com/

[Mojolicious] Re: Need help (feedback) with Mojo::Redis2 - A new pure-perl non-blocking I/O Redis driver

2014-08-05 Thread Jan Henning Thorsen
I pushed an experimental release to CPAN now: https://metacpan.org/pod/Mojo::Redis2 -Any- feedback is more than welcome. On Sunday, June 29, 2014 10:21:28 PM UTC+2, Daniel Mantovani wrote: > > Perfect then, thanks Jan > > El domingo, 29 de junio de 2014 03:50:09 UTC-3, Jan Henning Thorsen > esc

[Mojolicious] Re: Need help (feedback) with Mojo::Redis2 - A new pure-perl non-blocking I/O Redis driver

2014-06-29 Thread Daniel Mantovani
Perfect then, thanks Jan El domingo, 29 de junio de 2014 03:50:09 UTC-3, Jan Henning Thorsen escribió: > > The on(message => $channel => ...) API is not going to be part of > Mojo::Redis2. It will just be on(message => sub { my ($self, $message, > $channel) = @_ }); The reason for that is to ha

[Mojolicious] Re: Need help (feedback) with Mojo::Redis2 - A new pure-perl non-blocking I/O Redis driver

2014-06-28 Thread Jan Henning Thorsen
The on(message => $channel => ...) API is not going to be part of Mojo::Redis2. It will just be on(message => sub { my ($self, $message, $channel) = @_ }); The reason for that is to have a consistent API. (on() is already defined in Mojo::EventEmitter) And yes, it will only have one connection

[Mojolicious] Re: Need help (feedback) with Mojo::Redis2 - A new pure-perl non-blocking I/O Redis driver

2014-06-27 Thread Daniel Mantovani
Yes it absolutly matters, I need a different channel per connected websocket So if I understood correctly inside my websocket route I could write something like: my $applianceid = ... (some unique identifier for each appliance, I get it from a custom header) my $redis = Mojo::Redis2->new; $redi

[Mojolicious] Re: Need help (feedback) with Mojo::Redis2 - A new pure-perl non-blocking I/O Redis driver

2014-06-27 Thread Jan Henning Thorsen
I had some typos: I meant subscribing to "foo" and then "bar". (not sure if that matters for the example though) Also the $old comments should be "now there is two connections to the Redis database". On Friday, June 27, 2014 3:09:35 PM UTC+2, Jan Henning Thorsen wrote: > > Mojo::Redis2 can (or a

[Mojolicious] Re: Need help (feedback) with Mojo::Redis2 - A new pure-perl non-blocking I/O Redis driver

2014-06-27 Thread Jan Henning Thorsen
Mojo::Redis2 can (or at least it will be able to) (p)subscribe multiple times, using just one connection. I will try to illustrate the difference to be sure I understand you: my $old = Mojo::Redis->new; my $s1 = $old->subscribe("foo"); my $s2 = $old->subscribe("foo"); # now you two conn

[Mojolicious] Re: Need help (feedback) with Mojo::Redis2 - A new pure-perl non-blocking I/O Redis driver

2014-06-27 Thread Daniel Mantovani
Hi Jan, I´ve using Mojo::Redis and find it very convenient as the glue that allows to comunicate non-blocking among different processes (toads) when running hypnotoad (using subscribe and publish, just as the "Websocket example" in the module's synopsis). Something I would suggest for you to