Disabling cache clearing on newly created pages

I am currently running a website that creates new pages in the backend on filled out contact forms (these pages are just for backend organisation and dont have a frontend view).

Now my problem is that this website is also using the kirby cache, but now the cache gets cleared every time the form is filled out (which is about every 2-3 minutes), and i would like to disable the cache clearing in the case of these form backend pages being created.

I have found this resource about this topic, yet its 5y+ old and about K2, is there any way to do this in Kirby 3?

There is nothing to stop the pages cache from flushing.
I guess your best bet would be to create a page model for those user generated pages, and override the commit function. Copy everything from the Kirby source, just skip the $kirby->cache('pages')->flush(); line.

1 Like

Yea that would be the last resort I guess, though a nightmare for updateability in the future…
Appreciate the input!

If you don’t use hooks for that page, you could also skip most of the function:

	protected function commit(string $action, array $arguments, Closure $callback)
	{
		$argumentValues = array_values($arguments);
		$this->rules()->$action(...$argumentValues);
		return $callback(...$argumentValues);
	}

Maybe this reduces the surface for future breaking changes.

1 Like

Great idea, sadly it is the case that im using hooks for these pages :confused: