memcache python API key collisionsFwd: key collisions

Jehiah Czebotar jehiah at gmail.com
Thu Mar 22 13:02:57 UTC 2007


I have also written a pooling wrapper for the python client which
handles multi-threading

http://jehiah.cz/download/MemcachePool.py.txt

--
Jehiah

On 3/21/07, rkmr.em at gmail.com <rkmr.em at gmail.com> wrote:
> Thanks a lot, I will forward this again to the maintainer and try to
> get it patched.
> I hope this ends my long standing problem of memcached key collisions!
> cheers
>
>
> On 3/21/07, Dave St.Germain <dcs at tabblo.com> wrote:
> > I submitted a patch back to the maintainer to fix exactly this
> > problem.  It's simple:  make Client subclass threading.local
> > (requires python 2.4 or greater)
> >
> > 65c65,73
> > < class Client:
> > ---
> >  > try:
> >  >     # Only exists in Python 2.4+
> >  >     from threading import local
> >  > except ImportError:
> >  >     # TODO:  add the pure-python local implementation
> >  >     class local(object):
> >  >         pass
> >  >
> >  > class Client(local):
> > 107a116
> >  >         local.__init__(self)
> >
> >
> >
> >
> > On Mar 21, 2007, at 6:54 PM, rkmr.em at gmail.com wrote:
> >
> > > Yeah, I am using same memcache object across multiple threads I think.
> > > Can you give the example of how you use it in a multi-threaded app?
> > >
> > >
> > >
> > > On 3/21/07, Philip Neustrom <philipn at gmail.com> wrote:
> > >> I've never been able to reproduce this, and I haven't seen any test
> > >> code that reproduces it, either.  I'd be glad to fix this myself if I
> > >> knew what was going wrong here :/
> > >>
> > >> From what I understand, though, you're using the same memcache object
> > >> across multiple threads without considering what happens when
> > >> multiple
> > >> clients step on each other's feet?
> > >>
> > >> --Philip Neustrom
> > >>


More information about the memcached mailing list