django-constance
django-constance copied to clipboard
Advice needed: Wrap Redis backend with in-memory backend function?
Describe the problem
Using the Redis Backend, and calling config.VARIABLE repeatedly for the many variables slows down the performance ((tested)).
I ask, from a theoretic standpoint:
Is there something to gain from wrapping the calls to constance values with an in-memory cache (e.g get_constance_value(value, cache_ttl)) that will get the value from Redis the first time, and keep it in-memory (e.g. for 60 seconds)?
You can try to use CachingRedisBackend
via CONSTANCE_BACKEND = 'constance.backends.redisd.CachingRedisBackend'
. See details in docs.