Closed gerritvanaaken closed 7 years ago
There is: $page->reset()
. The only problem with this method is, that it never will be called, because the page is loaded from the cache and so the method is not getting called. I try to look for an alternative …
And adding the current page temporarily to cache.ignore
does not work, because pages are cached before the code of plugin is executed.
It seems like this problem can currently not be fixed. Comments are dynamic content and don’t go together with Kirby’s caching strategy.
Maybe the Kirby team has to change the caching bevahiour. If a page is called with a post request and post data incoming, the cache will not be used.
I found a black-magic method of ignoring the cache when previewing or posting a comment. Now I have discovered, that you would also have to ignore the page when rendering the form, regardless of whether or not a comment was posted. The form contains a hidden input field with a random key for extra security (e.g. to prevent cross-site request forgery). This means, that you would have to ignore your articles at all times from the cache.
This can be achieved using a wildcard ignore pattern:
c::set('cache.ignore', array(
'weblog/*'
));
If you have kirby file cache activated, you will never see the comment preview, and so you can never send any comment :-( Maybe there is a kirby api for explicitely deleting the cache for the page you are commenting on.