We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Manual removing view cache

I built two applications on the Phalcon PHP framework:

  • frontend, which is based on Phalcon Website
  • and backend, which is based on Vokuro.

In production mode I need to remove view cache for following content after database update from the backend:

  • /en/encyklopaedia/
  • /en/encyklopaedia/p/
  • /en/encyklopaedia/p/payload.html
  • /en/tutorials/
  • /en/tutorials/setup-in-Debian-9.html

In production mode in /storage/cache/view Phalcon is creating following files for above urls:

  • _en_encyklopaedia_.cache
  • _en_encyklopaedia_p_payload.html.cache
  • _en_encyklopaedia_p_payload.html.cache
  • _en_tutorials_.cache
  • _en_tutorials_setup-in-Debian-9.html.cache

What is the key to delete them:

$this->getDI()->get('viewCache')->delete($cacheKey)

?

Thanks for your time.

I found out that files under /storage/cache/view have exactly the same name as cache keys.

It maybe useful for someone in the future.