django-dynamic-preferences icon indicating copy to clipboard operation
django-dynamic-preferences copied to clipboard

Support other cache than 'default'

Open rutger-emesa opened this issue 3 years ago • 1 comments

There is no way of configuring which cache should be used when caching preferences. The 'default' cache is always used. It would be nice if it were possible to configure this. Currently we have to monkey-patch the PreferencesManager to achieve this.

rutger-emesa avatar Feb 21 '22 16:02 rutger-emesa

Indeed, I can see how it could be an issue. I'd gladly review and merge a PR for this. If anyone wants to give it a try, you can:

  1. Add a new CACHE_NAME setting at https://github.com/agateblue/django-dynamic-preferences/blob/097c7766c2b895cd805c919ce6ac4a8a8dccc885/dynamic_preferences/settings.py (with a default to default for backward compatibility
  2. Update https://github.com/agateblue/django-dynamic-preferences/blob/07362d97a24c26158b13a58a344feaa7193846aa/dynamic_preferences/managers.py#L28 to use the CACHE_NAME setting defined in 1.
  3. A couple of lines in https://github.com/agateblue/django-dynamic-preferences/blob/develop/docs/installation.rst#settings to document this new setting

agateblue avatar Feb 21 '22 21:02 agateblue