A
A
Alexander2015-07-13 08:28:56
MODX
Alexander, 2015-07-13 08:28:56

How to clear the cache when creating a page from the frontend?

On MODx Revo, I use the ms2form add-on to create pages through the frontend. The trouble is that the cache is not updated during creation, and all links leading to a new document (breadcrumbs, for example) do not work until you clear the cache manually in the admin panel. This is not good, since the site assumes a large number of user-created pages.
I created a plugin and hung it on the OnDocFormSave event with the following code:

$res = $modx->getObject('modResource', 106);
$res->clearCache();

106 is the ID of the parent resource where the new pages are created. In theory, its cache should be cleared at the OnDocFormSave event. But alas, nothing happens.
Tell me what and where you need to register so that the cache is updated when the page is created?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question