The problem I have with shared connections is that I have no idea how to do 
transactions over them. I don't think it's possible. Often in Redis, people 
only do atomic operations anyway, so it shouldn't be a problem.

"I have a bad feeling about this" :)

My case could be different as well, since "connect" is very cheap in my 
setup. (Redis on the same server as Mojo without AUTH).


On Thursday, October 2, 2014 10:23:57 PM UTC+2, Alberto Mijares wrote:
>
> Thank you Jan. 
>
> I'll give a try. Anyway, why don't you like shared connections? I 
> think it's a way to avoid the overhead of TCP, do you have a better 
> approach? 
>
> Regards, 
>
>
> Alberto Mijares 
>
>
>
> On Thu, Oct 2, 2014 at 7:57 AM, Jan Henning Thorsen 
> <[email protected]> wrote: 
> > Hi, 
> > 
> > I'm not sure how to do that. You could create a shared connection in 
> each 
> > fork and then re-use that, but I have no idea how that would actually 
> work. 
> > 
> >   helper redis => sub { 
> >     my $c = shift; 
> >     $c->app->defaults->{redis} ||= Mojo::Redis2->new; 
> >   }; 
> > 
> > I've never tried that myself (since I don't like sharing connections 
> between 
> > requests), but it should work if you're only doing simple things like 
> > get/set/... 
> > 
> > Mojo::Redis2 doesn't have a pool, but it has a single connection pr 
> > operation type: blocking/non-blocking/pubsub/... 
> > 
> > Patches are welcome though :) (I've written Mojo::Redis2 and contributed 
> to 
> > Mojo::Redis) 
> > 
> > 
> > On Wednesday, October 1, 2014 9:09:51 PM UTC+2, Alberto Mijares wrote: 
> >> 
> >> Hi list, 
> >> 
> >> I'd like to keep a fixed number of open connections to Redis and each 
> >> time the app is reached by a request, the query is send using one of 
> >> these previously opened connections. 
> >> 
> >> Can you give me some ideas on how to achieve this in the Mojo way? Any 
> >> reference? 
> >> 
> >> Thanks in advance, 
> >> 
> >> Alberto Mijares 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Mojolicious" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to [email protected]. 
> > To post to this group, send email to [email protected]. 
> > Visit this group at http://groups.google.com/group/mojolicious. 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to