My Magento store front server have no routine to clear cache, what result in slow Magento(cause it take to long to read cache files). Front server do not run cron.php, all jobs run over backend server.

Today, i am cleaning Magento front server var/cache folder manually to speed up Magento and don`t let cache files grow too much.

How can i automate this routine? Create a cron to rm -rf * from var/cache one time a day? There is a custom module to help with this issue?

1 Answer 1


The best and only way is to use the magento cron job. Do not rm manually these files, let this done by the cronjob. Take a look into the shell directory in your magento installation directory. There is a file called log.php

Try on your console:

php -f log.php clean

Magento never deletes all entrys in your cachefolder and your database. This is because Magento needs some "old" data.

  • Perfect. Do you know when should a run? Every hour, every day? Commented Aug 15, 2017 at 18:35
  • According to my research, this command just clear Magento log, not the cache. I just found this article, docs.nexcess.net/article/how-to-flush-your-magento-cache.html, but it not tells me when clear, but the command php -r 'require "app/Mage.php"; Mage::app()->getCacheInstance()->flush();' works Commented Aug 21, 2017 at 13:39

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.