Changes between Initial Version and Version 2 of Ticket #33092


Ignore:
Timestamp:
Sep 8, 2021, 4:47:19 PM (3 years ago)
Author:
Nick Pope
Comment:

So, yes, pymemcache.Client is not thread-safe. We are using pymemcache.HashClient so that we can support connections to multiple servers.

I note that pymemcache.PooledClient is thread-safe according to the documentation. We can pass the use_pooling flag to HashClient. Unfortunately pymemcache's documentation is a little sparse!

If I add 'OPTIONS': {'use_pooling': True} to your CACHES configuration in your reproducer the problem goes away for me.

Would you be prepared to open a PR with a tweak to the documentation? I already mentioned use_pooling in at the end of the cache arguments section, so maybe we just need to amend the sentence before?

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #33092

    • Property Cc Andrew Godwin Nick Pope added
    • Property Triage Stage UnreviewedAccepted
    • Property Summary PyMemcacheCache backend fails when running as a wsgi application with gevent worker classAdd note regarding thread-safety when using PyMemcacheCache.
    • Property Type BugCleanup/optimization
  • Ticket #33092 – Description

    initial v2  
     1For thread-safety when using `pymemcache` the option `'use_pooling': True` can be passed via `OPTIONS` which will make `pymemcache.HashClient` use `pymemcache.PooledClient` instead of `pymemcache.Client` internally.
     2
     3Some documentation should be added or improved.
     4
     5----
     6
    17In our application we were using the MemcachedCache backend to connect to a memcached server. Since this backend will be removed in Django 4.1 we thought we'd migrate to the alternative PyMemcacheCache backend as suggested in the Django documentation at: https://docs.djangoproject.com/en/3.2/topics/cache/
    28
Back to Top