agateblue / django-dynamic-preferences

Dynamic global and instance settings for your django project
https://django-dynamic-preferences.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
350 stars 87 forks source link

Caching behavior #247

Closed henadzit closed 3 years ago

henadzit commented 3 years ago

At the moment django-dynamic-preferences caches values indefinitely if caching is used. There are potentials issues with this approach where the database and the cache get out of sync. There are a few examples of how this could happen:

Having a timeout would also let to update the setting in the database directly without using Django. At the moment this would require clearing cache manually.

I see three potential paths to introduce more flexible caching:

Please let me know what you think and I can help with PR for this change.

agateblue commented 3 years ago

Hi there, I think it make sense to at least remove the None param in the cache.set to use the default cache value. Having a dedicated setting dynamic_preferences for this (defaulting to the default cache timeout) would also work great!

henadzit commented 3 years ago

@agateblue I've created PR for using the default cache timeout. Could you please have a look?