Just got into trouble with the cache and thought that I post it here instead of opening a new topic.
My question is how can I flush the cache manually? The docs say that I can use something like
But my question is also where do I need to place that piece of code in order to get executed?
I am using a one-pager where every section of the page is a snippet. The news.php snippet is responsible for displaying Facebook events. The fetching of those events happens in a plugin called “FacebookEvents” (via api) and it then stores it locally in
content/1-news/. When the event is expired it flushes the
content/1-news/ folder and requests the next event, storing it again.
Now when I have caching activated this is not working anymore. The code for checking Facebook for new events will not be executed and the content (old event) will get served from cache until some action that makes the internal Kirby flush the cache gets executed.
This is how the snippet news.php looks like:
// get the $page object
$news = $pages->findByURI('news');
$fbe = FacebookEvents($news);
// if the event expired getNews will return the next event, else the locally stored
$fb_event = $fbe->getNews('12345');
How can I flush the cache in a plugin? What code will get executed if caching is activated? Do I need a controller or something for the “home” template?