It depends on the Cache::Memcached::* client. Regular Cache::Memcached will do the right thing and use a single socket. Cache::Memcached::libmemcached will use a different socket every time. Don't remember what ::Fast does but it's easy to test.
I wrote an extension to Cache::Memcached::libmemcached that reuses the same socket which I've now remembered to contribute back. :)
Jon
> Thanks for reply!
>
> Please answer every instance of CHI has own connect to cache?
> If i will have 5 instances of CHI in one process for one unix socket (or TCP/IP socket?)
> but with different namespaces - how many connections will be there?
>
> I mean Memcached for example
> But may be you will cannot answer because this is into driver's code?
>
> > Unfortunately CHI drivers are written with the assumption that the namespace is
> > constant. This allows them to do some optimizations, in particular setting things up at
> > construction time and not having to recheck the namespace on every set/get method.
> >
> > Is there no Dancer plugin that will dynamically return different cache objects depending
> > on the current site?
> >
> > Otherwise, you could probably create a wrapper class that does this, by forwarding methods
> > to a driver created or retrieved on the fly. You'll have to figure out how to fit
> > namespace into every one of CHI's methods though.
> >
> >
> > > Good day!
> > >
> > > Sometimes i very need to setup namespace for CHI cache during runtime not from constructor
> > > but from method.
> > > For example i use Dancer for application and one Dancer will have a some sites inside
> > > itself. I can use Dancer::Plugin::Cache::CHI but i cannot change a namespace between
> > > applications (for separation of sites).
> > >
> > > Is it possible to add this feature at near time?
> > > Or if you have not a free time for this please let me know - i can try to add this feature
> > > myself. I am interested your plans about this feature
> > >
> > > Thanks!
On Dec 5, 2011, at 3:45 PM, Perlover wrote:
> Thanks for reply!
>
> Please answer every instance of CHI has own connect to cache?
> If i will have 5 instances of CHI in one process for one unix socket (or TCP/IP socket?) but with different namespaces - how many connections will be there?
>
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/jonswar/perl-chi/issues/7#issuecomment-3025673