Skip to content

fix(settings): map removed memcached.MemcachedCache to PyMemcacheCache#59

Merged
alexzhangs merged 1 commit into
developfrom
fix/cache-backend-bc-django5
Jun 9, 2026
Merged

fix(settings): map removed memcached.MemcachedCache to PyMemcacheCache#59
alexzhangs merged 1 commit into
developfrom
fix/cache-backend-bc-django5

Conversation

@alexzhangs

Copy link
Copy Markdown
Owner

Problem

The Django 5.2 upgrade (#49) switched the memcached driver to pymemcache and supports SSM_CACHES_BACKEND=memcached.PyMemcacheCache. But deployments upgraded in place from Django 3.x still have SSM_CACHES_BACKEND=memcached.MemcachedCache persisted in their .ssm-env — and that backend was removed in Django 4.1. On Django 5 they raise InvalidCacheBackendError and the manager won't boot.

(Confirmed on the live aiview.com hub: its .ssm-env carries SSM_CACHES_BACKEND=memcached.MemcachedCache.)

Fix

Transparently remap the dropped alias memcached.MemcachedCachememcached.PyMemcacheCache (with a DeprecationWarning), so existing deployments survive the Django 5 image without manual env surgery. The memcached.* LOCATION wiring already added in #49 then applies normally.

Note

This also matters for the cross-process django-cache-lock the EIP-rotation tasks use: it needs the shared memcached cache, so silently falling back to anything else (or failing to boot) would be worse than remapping.

🤖 Generated with Claude Code

The Django 5.2 upgrade switched the memcached driver to pymemcache, but
deployments upgraded in place from Django 3.x still have
SSM_CACHES_BACKEND=memcached.MemcachedCache persisted in their .ssm-env.
That backend was removed in Django 4.1, so on Django 5 the manager raises
InvalidCacheBackendError and fails to boot.

Transparently remap the dropped alias to memcached.PyMemcacheCache (with a
DeprecationWarning) so existing deployments survive the upgrade without
manual .ssm-env edits. Fresh deployments should set
SSM_CACHES_BACKEND=memcached.PyMemcacheCache directly.

Discovered reviewing the live aiview.com hub, whose .ssm-env still carries
the old backend string.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.51%. Comparing base (03315c2) to head (e90b8c0).

Files with missing lines Patch % Lines
...hadowsocks_manager/shadowsocks_manager/settings.py 0.00% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop      #59      +/-   ##
===========================================
- Coverage    93.64%   93.51%   -0.14%     
===========================================
  Files           53       53              
  Lines         2850     2854       +4     
  Branches       238      239       +1     
===========================================
  Hits          2669     2669              
- Misses         112      115       +3     
- Partials        69       70       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@alexzhangs
alexzhangs merged commit 26b1f79 into develop Jun 9, 2026
7 of 9 checks passed
@alexzhangs
alexzhangs deleted the fix/cache-backend-bc-django5 branch June 9, 2026 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant