Advice needed: Wrap Redis backend with in-memory backend function?
gabriels1234 opened this issue · 1 comments
gabriels1234 commented
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)?
horpto commented
You can try to use CachingRedisBackend
via CONSTANCE_BACKEND = 'constance.backends.redisd.CachingRedisBackend'
. See details in docs.