Clear cache as an automated job

Permalink
Hi, 1) how do I add the "clear cache" action to the "automated jobs" list? and 2) how to suggest to the core C5 developers to add "clear cache" as a default automated job?

 
mhawke replied on at Permalink Reply
mhawke
kesnav replied on at Permalink Reply
Interesting addons. Thanks. The "Clear Cache" is what I'm looking for. However, does it do the job correctly?

I can see the only thing it does is:
Cache::flush();


While the C5 core code to clear the cache is:

public function do_clear() {
   if ($this->token->validate("clear_cache")) {
      if ($this->isPost()) {
         Cache::flush();
         $env = Environment::get();
         $env->clearOverrideCache();
         $this->redirect('/dashboard/system/optimization/clear_cache', 'cache_cleared');
      }
   } else {
      $this->set('error', array($this->token->getErrorMessage()));
   }
}


Should I call that "clearOverrideCache()" function as well?
mhawke replied on at Permalink Best Answer Reply
mhawke
Yeah, this add-on was built for version 5.3 so I suppose you need to update it. I would add:

Cache::flush();
$env = Environment::get();
$env->clearOverrideCache();


and see how it works.
kesnav replied on at Permalink Reply
Thanks mhawke. It seems to be working fine. Hopefully the addon author will update it. I have asked him for support regarding this matter.
TheRealSean replied on at Permalink Reply
TheRealSean
Also worth pointing to some code that Jordan Lev created to use automated jobs.
http://andrewembler.com/posts/improving-the-performance-of-zend-cac...

Code can be seen here,
http://pastie.org/5476483

It removes files older then 1 week
JohntheFish replied on at Permalink Reply
JohntheFish
I built Jordan's method and a selection of others into a free addon job, currently in the prb:
http://www.concrete5.org/marketplace/review_pending/-/view_detail/1...

There is an associated cache filler job, also currently in the prb:
http://www.concrete5.org/marketplace/review_pending/-/view_detail/1...