-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Add pymemcache support #9977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add pymemcache support #9977
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates the Celery cache backend from pylibmc/python-memcached to pymemcache as the exclusive memcached client library, simplifying dependencies while maintaining backward compatibility.
Key changes:
- Replaces
import_best_memcache()/get_best_memcache()withget_memcache_client()that exclusively uses pymemcache - Implements HashClient for multiple servers and RetryingClient for configurable retry logic
- Maintains backward compatibility by accepting pylibmc-style URLs and ignoring the
behaviorsparameter
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| celery/backends/cache.py | Replaces multi-library detection logic with pymemcache-only implementation; adds ClientFactory with retry support |
| t/unit/backends/test_cache.py | Rewrites tests to use pymemcache mocks instead of pylibmc/python-memcached; adds new tests for retry and multi-server scenarios |
| requirements/extras/pymemcache.txt | Updates dependency from python-memcached to pymemcache>=3.4.0 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9977 +/- ##
==========================================
- Coverage 78.68% 78.68% -0.01%
==========================================
Files 153 153
Lines 19313 19326 +13
Branches 2214 2219 +5
==========================================
+ Hits 15196 15206 +10
- Misses 3817 3819 +2
- Partials 300 301 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Drop pylibmc and python-memcache and replace with pymemcache - Use pymemcache exclusively for cache backend - Add HashClient support for multiple servers - Add RetryingClient with configurable retry options - Maintain backward compatibility with pylibmc URLs - Update requirements: pymemcache>=3.4.0 - Rewrite tests for pymemcache-only implementation
Co-authored-by: Copilot <[email protected]>
Drop pylibmc and python-memcache and replace with pymemcache