Switch to PyMemcacheCache backend

The new library is already supported in django 3.2 and gives us better
support for IPv6 addresses and encrypted connections.

Also, the same library is being used by all other OpenStack projects.

Depends-on: https://review.opendev.org/c/openstack/devstack/+/898302
Closes-Bug: #2039225
Change-Id: I964ac4d0d62dff4c1f7c1f1373763fbf23024269
This commit is contained in:
Radomir Dopieralski 2023-08-17 17:06:14 +02:00 committed by Takashi Kajinami
parent 09d0975ee0
commit caa99b2010
4 changed files with 11 additions and 3 deletions

View File

@ -95,7 +95,7 @@ SECRET_KEY = secret_key.generate_or_read_from_file(
# https://docs.djangoproject.com/en/1.11/topics/http/sessions/.
#CACHES = {
# 'default': {
# 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
# 'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
# 'LOCATION': '127.0.0.1:11211',
# },
#}

View File

@ -172,7 +172,7 @@ MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
'LOCATION': '127.0.0.1:11211',
},
}

View File

@ -0,0 +1,8 @@
---
upgrade:
- |
Default cache backend has been changed from MemcachedCache backend to
PyMemcacheCache backend. MemcachedCache backend was deprecated in django
3.2 and was later removed in django 4.1. Note that the LOCATION option
needs to be updated in case memcached servers use IPv6, so that inet6
prefix is not included.

View File

@ -12,7 +12,7 @@ nodeenv>=0.9.4 # BSD
pytest>=5.3.5 # MIT
pytest-django>=3.8.0 # BSD (3 clause)
pytest-html>=2.0.1 #MPL-2.0
python-memcached>=1.59 # PSF
pymemcache>=4.0.0 # Apache 2.0 License
selenium>=2.50.1 # Apache-2.0
testscenarios>=0.4 # Apache-2.0/BSD
testtools>=2.2.0 # MIT