Skip to content

Commit

Permalink
Implementing cleanup of cache engines
Browse files Browse the repository at this point in the history
  • Loading branch information
Lubomir Stork committed May 7, 2010
1 parent 13eaab5 commit cbac12c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
16 changes: 16 additions & 0 deletions libs/clear_cache.php
Expand Up @@ -2,6 +2,22 @@

class ClearCache {

public function engines($engines = array()) {
$result = array();

$keys = Cache::configured();

if ($engines) {
$keys = array_intersect($keys, $engines);
}

foreach ($keys as $key) {
$result[$key] = Cache::clear(false, $key);
}

return $result;
}

public function files($folders = array()) {
$deleted = $error = array();

Expand Down
9 changes: 9 additions & 0 deletions vendors/shells/clear_cache.php
Expand Up @@ -6,6 +6,15 @@ class ClearCacheShell extends Shell {

public function main() {
$this->files();
$this->engines();
}

public function engines() {
$output = $this->_Cleaner->engines($this->args);

foreach ($output as $key => $result) {
$this->out($key . ': ' . ($result ? 'cleared' : 'error'));
}
}

public function files() {
Expand Down

0 comments on commit cbac12c

Please sign in to comment.