I have a snippet that updates some system settings by updating and saving modSystemSetting objects. I noticed that old settings are still coming from the cache.
Clearing the cache works:
$cacheManager = $modx->getCacheManager();
$cacheManager->clearCache();
But this clears the whole cache which isn't good. How could I clear only updated settings? Clearing all systems settings would work too.
Checkout the refresh function in modcachemanager.class.php
, look at each of the $providers
.
For system-settings
try to start with $cacheManager->generateConfig()
and see from there. Maybe you'd need more then just the system settings, like context settings, etc..
If you go further, checkout using custom cache. You can delete specific keys in the cache $cacheManager->delete($key)
. See the Programmatic (Custom) Caching