Closed pesseyjulien closed 7 years ago
At first, the idea sounds good, but I'm not sure if it can be implemented in a safe way. If settings are modified by the app, cache values could be invalidated properly. But modifying them by e.g. Doctrine migrations would lead to inconsistency between cache and database.
I agree, but what if we empty the cache in this particular case ?
How? A migration was only one example.
Sorry for the delay of my answer.
If we relay on a third-party to cache, eg Redis, then we can delete every keys in case of a migration or something similar. Or a least warn the user.
In case of an update of an existing setting, then we can just delete the corresponding redis key.
I'm mentioning the feature because the LexikTranslationBundle is doing something similar to your bundle, but with translations, and they are using a cache system.
Maybe it could be an option, deactivated by default ?
How about #35?
Nice ! Thanks !
So when we do $this->get('craue_config')->set($index, $data)
, the cache is automatically cleared for this index or we need to do it ?
This will be done by the bundle, yes. Feel free to test it out and let me know about possible improvements for the PR.
Alright, I will ! Thanks a bunch again !
I have just tried it using DoctrineCacheBundle and redis as cache provider, and it's working great ! Thanks a bunch for this cool new feature, it will help save a lot of queries ;) When do you think it will be merged to the master branch ?
Aaaand merged. 😏
Thanks again, great feature ! ;)
Hi,
Thanks for this great bundle.
I think it would be even more awesome if we could cache the results of the doctrine queries (using redis for example), and of course, invalidate when the value changes.
What do you think ?
-Julien