You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
clientconfig.clear_cache does not clear the cache when ClientConfig settings are saved #210
ClientConfig's system setting clientconfig.clear_cache does not clear the cache when ClientConfig settings are saved
Step to reproduce
Set clientconfig.clear_cache to Yes [default]
Observed behavior
When saving a ClientConfig setting, the cache should be cleared [as I understand it] - but in all my tests, it's still necessary to manually clear the cache or call the setting uncached.
Expected behavior
MODX cache should be cleared
Environment
ClientConfig version 2.4.0-pl,
MODX version 3.0.4-pl,
PHP version 8.2.
Just to confirm, you're saying it does not clear the resource cache (or a different one), and this is all with the standard cache setups?
I can just tell for myself, but I am running a default MODX 3.0.4. clientconfig.clear_cache is set to Yes. I render an example client config setting in the default template. When I change the value in client config and save it I would expect the cache to be cleared instantly. Instead the old values are still visible until I clear the cache either manually, or save a resource/chunk/snippet.
The previous error messages Directory not empty can be ignored. This was because we are using a custom resource cache handler which uses the .cache.gz extension for cache files instead of the default .cache.php. Because of that the files were not getting deleted for some modCacheManager functions. We have resolved this issue by using the default extension instead.
There is still something odd happening though. Upon saving the client configuration and immediately reloading the front-end, the old values persist. Yet, when waiting for 2-3 seconds after saving and then reloading the front-end, the correct values appear.
Just to be clear, the resource cache does get cleared, but it gets filled with the old client config values if you refresh the front-end page fast enough.
Activity
travisbotello commentedon Apr 16, 2024
Confirmed. Bumping it :)
Mark-H commentedon Apr 16, 2024
Just to confirm, you're saying it does not clear the resource cache (or a different one), and this is all with the standard cache setups?
travisbotello commentedon Apr 16, 2024
I can just tell for myself, but I am running a default MODX 3.0.4.
clientconfig.clear_cacheis set toYes. I render an example client config setting in the default template. When I change the value in client config and save it I would expect the cache to be cleared instantly. Instead the old values are still visible until I clear the cache either manually, or save a resource/chunk/snippet.deJaya commentedon Apr 16, 2024
That's the experience I have as well. Standard cache setup.
deJaya commentedon Apr 16, 2024
There was some discussion here
travisbotello commentedon Apr 16, 2024
Yes, this is clearly a bug...I would expect client config to clear the whole cache after save when this setting is enabled.
verstratenbram commentedon Apr 22, 2024
Running into this issue too. Possibly having something to do with
https://github.com/modmore/ClientConfig/blob/master/core/components/clientconfig/processors/mgr/settings/save.class.php#L73
From the modx error log:
Current workaround is to create a plugin on the
ClientConfig_ConfigChangeevent and manually clearing the resource folder.Mark-H commentedon Apr 22, 2024
Correct @verstratenbram - that's exactly the line that is supposed to wipe the resource cache clean and I'm not sure why it wouldn't. 😂
I've wondered if we need to change that to use the
refresh()instead:verstratenbram commentedon Apr 22, 2024
Hi @Mark-H, that seems to resolve the issue.
Don't understand why the original code doesn't work though.
verstratenbram commentedon May 7, 2024
I've looked a bit further into this issue.
The previous error messages
Directory not emptycan be ignored. This was because we are using a custom resource cache handler which uses the.cache.gzextension for cache files instead of the default.cache.php. Because of that the files were not getting deleted for somemodCacheManagerfunctions. We have resolved this issue by using the default extension instead.There is still something odd happening though. Upon saving the client configuration and immediately reloading the front-end, the old values persist. Yet, when waiting for 2-3 seconds after saving and then reloading the front-end, the correct values appear.
Just to be clear, the resource cache does get cleared, but it gets filled with the old client config values if you refresh the front-end page fast enough.
meeheee commentedon May 13, 2025
+1