For test purposes with magento 2.2 there was form created which task is simply to store some text in database and all these messages should be shown at same page above that form as list.

So the problem is that after saving magento displays the old list without the newly added message and as it turned out the problem in the cache, namely in the full page cache i.e if you reset it then absolutely all the messages will be displayed.

The form was made by absolute analogy with the feedback form from vendor/magento/module-contact. The only solution that I have found is to call $this->cacheTypeList->cleanType('full_page'); after successfully saving to the database (where cacheTypeList is an object with an interference \Magento\Framework\App\Cache\TypeListInterface from the constructor)

And the question arises is it right way and how to act if not? (To clean all cache obviously somehow not really, I suspect that there has to be a method of cleaning of cache only of a specific page)


1 Answer 1


I manage to find a solution myself at last. In xml layout file we should add an attribute cacheable="false" to our block with form. This will cause the entire page to stop being cached, but it is way better than to clean the cache of all pages at once.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.