Skip to content
This repository was archived by the owner on Dec 21, 2018. It is now read-only.

Tweak cache settings for better memory usage #289

Merged
merged 1 commit into from
Dec 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions standup/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ def path(*paths):
parser=django_cache_url.parse,
default='locmem:default')
}
if CACHES['default'].get('BACKEND', '') == 'django.core.cache.backends.locmem.LocMemCache':
# If we're using locmem, set timeout for 60 seconds and restrict
# cache to 100 things so as to not run rampant with memory usage.
CACHES['default']['timeout'] = 60
CACHES['default'].setdefault('OPTIONS', {})['MAX_ENTRIES'] = 100
CACHE_MIDDLEWARE_SECONDS = config('CACHE_MIDDLEWARE_SECONDS', default='30', parser=int)
CACHE_FEEDS_SECONDS = config('CACHE_FEEDS_SECONDS', default='1800', parser=int) # 30 min

Expand Down