Settings icon indicating copy to clipboard operation
Settings copied to clipboard

[Feature] Cache settings

Open dkwiebe opened this issue 5 years ago • 3 comments

Add support to SettingsServiceProvider.php to cache settings using the Laravel cache. This slightly improves our performance by storing all the settings in whichever cache we use. For high traffic sites this saves a lot of database access.

dkwiebe avatar Dec 12 '19 06:12 dkwiebe

BOOM! Your first PR with us, thank you so much! Someone will take a look at it shortly.

Please keep in mind that:

  • if this constitutes a breaking change, it might take quite a while for this to get merged; we try to emulate the Laravel release cycle as much as possible, so developers can upgrade both software once; this means a new big release every ~6 months;
  • even if it's a non-breaking change, it might take a few days/weeks for the PR to get merged; unless it's a no-brainer, we like to have some community feedback on new features, before we merge them; this leads to higher-quality code, in the end; we learnt this the hard way :-)
  • not all PRs get merged; sometimes we just have to hold out new features, to keep the packages lean; sometimes we don't include features that only apply to niche use cases;
  • we're not perfect; if you think we're wrong, call us out on it; but in a kind way :-) we all make mistakes, best we learn from them and build better software together;

Thank you!

-- Justin Case The Backpack Robot

welcome[bot] avatar Dec 12 '19 06:12 welcome[bot]

Thank you for the PR @dkwiebe ! I agree - I see no reason why we shouldn't cache the settings, and prevent all those queries on page load.

One thing popped up when looking over your PR (metioned it here too https://github.com/Laravel-Backpack/Settings/issues/90#issuecomment-565978500): I think we also need to refresh the cache when a Setting is edited, so that the new value is instantly available. Otherwise I think the Admin will go edit a setting, see the new value in the admin panel, but not understand why that new value is not used on his website. Right?

tabacitu avatar Dec 16 '19 09:12 tabacitu

Waiting this feature in new version!

marechenok avatar Aug 03 '22 08:08 marechenok