about memcached under mod_perl

2007-02-26 Thread Jeff Pang
Hello, I saw someone asked this question on memcached's list.And I also want to know the answer of it. Does anyone here have the experience on this item?Thanks. Quote: I'm using memcached under mod_perl.Can I "new" a memcached object at modperl's startup file and share it among all the apache ch

Re: about memcached under mod_perl

2007-02-26 Thread Jonathan Vanasco
On Feb 26, 2007, at 11:19 PM, Jeff Pang wrote: Hello, I saw someone asked this question on memcached's list.And I also want to know the answer of it. Does anyone here have the experience on this item?Thanks. Yes. It seems to work fine with a single memcached connection for everything (

Re: about memcached under mod_perl

2007-02-27 Thread Perrin Harkins
On 2/27/07, Jonathan Vanasco <[EMAIL PROTECTED]> wrote: It seems to work fine with a single memcached connection for everything ( instantiated pre-fork ). That seems very unlikely to me, unless you are using it in a way that doesn't cause it to connect before forking. You can't open sockets, f

Re: about memcached under mod_perl

2007-02-27 Thread Jeff Pang
>I suggest loading the module in the parent but not opening any >connections until after the fork. > How to write the codes then?Currently I've written it as: sub handler { my $r = shift; my $q = Apache::Request->new($r); ... my $memd = new_memcached(); # open the socket to mem

Re: about memcached under mod_perl

2007-02-27 Thread Jonathan Vanasco
On Feb 27, 2007, at 8:40 AM, Perrin Harkins wrote: That seems very unlikely to me, unless you are using it in a way that doesn't cause it to connect before forking. You can't open sockets, fork and then use the same socket in both processes. Right now I connect pre-fork in the parent -- it w

Re: about memcached under mod_perl

2007-02-27 Thread Jonathan Vanasco
Ok. I just went through the CPAN code... at least in Cache::Memcached, no socket connection is made until a get. in fact, they all seem to be made as needed, and not cached. in any event, I use this code under MP2 , and do all my get/sets as MyApp::Functions::Memcached::memcached_