Skip to content

Commit

Permalink
chore: replace memcachecache with pymemcache backend (#32845)
Browse files Browse the repository at this point in the history
  • Loading branch information
mumarkhan999 authored Jul 26, 2023
1 parent f4616f0 commit 23d6966
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 64 deletions.
10 changes: 5 additions & 5 deletions cms/envs/bok_choy.env.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,39 @@
"BULK_EMAIL_DEFAULT_FROM_EMAIL": "[email protected]",
"CACHES": {
"celery": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "integration_celery",
"LOCATION": [
"localhost:11211"
]
},
"default": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "sandbox_default",
"LOCATION": [
"localhost:11211"
]
},
"general": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "sandbox_general",
"LOCATION": [
"localhost:11211"
]
},
"mongo_metadata_inheritance": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "integration_mongo_metadata_inheritance",
"LOCATION": [
"localhost:11211"
]
},
"staticfiles": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "integration_static_files",
"LOCATION": [
Expand Down
11 changes: 5 additions & 6 deletions cms/envs/bok_choy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ BUGS_EMAIL: [email protected]
BULK_EMAIL_DEFAULT_FROM_EMAIL: [email protected]
CACHES:
celery:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_celery
LOCATION: ['localhost:11211']
default:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: sandbox_default
LOCATION: ['localhost:11211']
general:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: sandbox_general
LOCATION: ['localhost:11211']
mongo_metadata_inheritance:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_mongo_metadata_inheritance
LOCATION: ['localhost:11211']
staticfiles:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_static_files
LOCATION: ['localhost:11211']
Expand Down Expand Up @@ -128,4 +128,3 @@ XQUEUE_INTERFACE:
url: http://localhost:18040
ZENDESK_API_KEY: ''
ZENDESK_USER: ''

10 changes: 5 additions & 5 deletions cms/envs/bok_choy_docker.env.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,39 @@
"BULK_EMAIL_DEFAULT_FROM_EMAIL": "[email protected]",
"CACHES": {
"celery": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "integration_celery",
"LOCATION": [
"edx.devstack.memcached:11211"
]
},
"default": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "sandbox_default",
"LOCATION": [
"edx.devstack.memcached:11211"
]
},
"general": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "sandbox_general",
"LOCATION": [
"edx.devstack.memcached:11211"
]
},
"mongo_metadata_inheritance": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "integration_mongo_metadata_inheritance",
"LOCATION": [
"edx.devstack.memcached:11211"
]
},
"staticfiles": {
"BACKEND": "django.core.cache.backends.memcached.MemcachedCache",
"BACKEND": "django.core.cache.backends.memcached.PyMemcacheCache",
"KEY_FUNCTION": "common.djangoapps.util.memcache.safe_key",
"KEY_PREFIX": "integration_static_files",
"LOCATION": [
Expand Down
11 changes: 5 additions & 6 deletions cms/envs/bok_choy_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ BUGS_EMAIL: [email protected]
BULK_EMAIL_DEFAULT_FROM_EMAIL: [email protected]
CACHES:
celery:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_celery
LOCATION: ['edx.devstack.memcached:11211']
default:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: sandbox_default
LOCATION: ['edx.devstack.memcached:11211']
general:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: sandbox_general
LOCATION: ['edx.devstack.memcached:11211']
mongo_metadata_inheritance:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_mongo_metadata_inheritance
LOCATION: ['edx.devstack.memcached:11211']
staticfiles:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_static_files
LOCATION: ['edx.devstack.memcached:11211']
Expand Down Expand Up @@ -125,4 +125,3 @@ XQUEUE_INTERFACE:
url: http://localhost:18040
ZENDESK_API_KEY: ''
ZENDESK_USER: ''

16 changes: 8 additions & 8 deletions cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2171,53 +2171,53 @@
'KEY_FUNCTION': 'common.djangoapps.util.memcache.safe_key',
'LOCATION': ['localhost:11211'],
'TIMEOUT': '86400', # This data should be long-lived for performance, BundleCache handles invalidation
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
},
'course_structure_cache': {
'KEY_PREFIX': 'course_structure',
'KEY_FUNCTION': 'common.djangoapps.util.memcache.safe_key',
'LOCATION': ['localhost:11211'],
'TIMEOUT': '7200',
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
},
'celery': {
'KEY_PREFIX': 'celery',
'KEY_FUNCTION': 'common.djangoapps.util.memcache.safe_key',
'LOCATION': ['localhost:11211'],
'TIMEOUT': '7200',
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
},
'mongo_metadata_inheritance': {
'KEY_PREFIX': 'mongo_metadata_inheritance',
'KEY_FUNCTION': 'common.djangoapps.util.memcache.safe_key',
'LOCATION': ['localhost:11211'],
'TIMEOUT': 300,
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
},
'staticfiles': {
'KEY_FUNCTION': 'common.djangoapps.util.memcache.safe_key',
'LOCATION': ['localhost:11211'],
'KEY_PREFIX': 'staticfiles_general',
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
},
'default': {
'VERSION': '1',
'KEY_FUNCTION': 'common.djangoapps.util.memcache.safe_key',
'LOCATION': ['localhost:11211'],
'KEY_PREFIX': 'default',
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
},
'configuration': {
'KEY_FUNCTION': 'common.djangoapps.util.memcache.safe_key',
'LOCATION': ['localhost:11211'],
'KEY_PREFIX': 'configuration',
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
},
'general': {
'KEY_FUNCTION': 'common.djangoapps.util.memcache.safe_key',
'LOCATION': ['localhost:11211'],
'KEY_PREFIX': 'general',
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
},
}

Expand Down
14 changes: 7 additions & 7 deletions cms/envs/devstack-experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,47 +53,47 @@ BULK_EMAIL_EMAILS_PER_TASK: 500
BULK_EMAIL_LOG_SENT_EMAILS: false
CACHES:
celery:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: celery
LOCATION:
- edx.devstack.memcached:11211
TIMEOUT: '7200'
configuration:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: 78f87108afce
LOCATION:
- edx.devstack.memcached:11211
course_structure_cache:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: course_structure
LOCATION:
- edx.devstack.memcached:11211
TIMEOUT: '7200'
default:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: default
LOCATION:
- edx.devstack.memcached:11211
VERSION: '1'
general:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: general
LOCATION:
- edx.devstack.memcached:11211
mongo_metadata_inheritance:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: mongo_metadata_inheritance
LOCATION:
- edx.devstack.memcached:11211
TIMEOUT: 300
staticfiles:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: 78f87108afce_general
LOCATION:
Expand Down
11 changes: 5 additions & 6 deletions lms/envs/bok_choy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,27 @@ BLOCK_STRUCTURES_SETTINGS:

CACHES:
celery:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_celery
LOCATION: ['localhost:11211']
default:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: sandbox_default
LOCATION: ['localhost:11211']
general:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: sandbox_general
LOCATION: ['localhost:11211']
mongo_metadata_inheritance:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_mongo_metadata_inheritance
LOCATION: ['localhost:11211']
staticfiles:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_static_files
LOCATION: ['localhost:11211']
Expand Down Expand Up @@ -252,4 +252,3 @@ XQUEUE_INTERFACE:

ZENDESK_API_KEY: ''
ZENDESK_USER: ''

11 changes: 5 additions & 6 deletions lms/envs/bok_choy_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,27 @@ BUGS_EMAIL: [email protected]
BULK_EMAIL_DEFAULT_FROM_EMAIL: [email protected]
CACHES:
celery:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_celery
LOCATION: ['edx.devstack.memcached:11211']
default:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: sandbox_default
LOCATION: ['edx.devstack.memcached:11211']
general:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: sandbox_general
LOCATION: ['edx.devstack.memcached:11211']
mongo_metadata_inheritance:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_mongo_metadata_inheritance
LOCATION: ['edx.devstack.memcached:11211']
staticfiles:
BACKEND: django.core.cache.backends.memcached.MemcachedCache
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
KEY_FUNCTION: common.djangoapps.util.memcache.safe_key
KEY_PREFIX: integration_static_files
LOCATION: ['edx.devstack.memcached:11211']
Expand Down Expand Up @@ -161,4 +161,3 @@ XQUEUE_INTERFACE:
url: '** OVERRIDDEN **'
ZENDESK_API_KEY: ''
ZENDESK_USER: ''

Loading

0 comments on commit 23d6966

Please sign in to comment.