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
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/
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
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
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
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
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
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
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