Skip to content
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

fix: infinite growth of cache when auto eviction is disabled #34210

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2193,7 +2193,7 @@
'KEY_PREFIX': 'course_structure',
'KEY_FUNCTION': 'common.djangoapps.util.memcache.safe_key',
'LOCATION': ['localhost:11211'],
'TIMEOUT': '7200',
'TIMEOUT': '604800', # 1 week
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
'OPTIONS': {
'no_delay': True,
Expand Down
2 changes: 1 addition & 1 deletion cms/envs/devstack-experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ CACHES:
KEY_PREFIX: course_structure
LOCATION:
- edx.devstack.memcached:11211
TIMEOUT: '7200'
TIMEOUT: '604800'
default:
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
OPTIONS:
Expand Down
2 changes: 1 addition & 1 deletion lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@
'KEY_PREFIX': 'course_structure',
'KEY_FUNCTION': 'common.djangoapps.util.memcache.safe_key',
'LOCATION': ['localhost:11211'],
'TIMEOUT': '7200',
'TIMEOUT': '604800', # 1 week
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
'OPTIONS': {
'no_delay': True,
Expand Down
2 changes: 1 addition & 1 deletion lms/envs/devstack-experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ CACHES:
KEY_PREFIX: course_structure
LOCATION:
- edx.devstack.memcached:11211
TIMEOUT: '7200'
TIMEOUT: '604800'
default:
BACKEND: django.core.cache.backends.memcached.PyMemcacheCache
OPTIONS:
Expand Down
5 changes: 3 additions & 2 deletions xmodule/modulestore/split_mongo/mongo_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,10 @@ def set(self, key, structure, course_context=None):
data_size = len(compressed_pickled_data)
tagger.measure('compressed_size', data_size)

# Structures are immutable, so we set a timeout of "never"
# We rely on the course structure cache default timeout, which should be
# high by default (~ a few days).
try:
self.cache.set(key, compressed_pickled_data, None)
self.cache.set(key, compressed_pickled_data)
regisb marked this conversation as resolved.
Show resolved Hide resolved
except Exception: # pylint: disable=broad-except
total_bytes_in_one_mb = 1024 * 1024
chunk_size_in_mbs = round(data_size / total_bytes_in_one_mb, 2)
Expand Down