PHPackages                             ceeram/clear\_cache - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. ceeram/clear\_cache

ActiveCakephp-plugin[CLI &amp; Console](/categories/cli)

ceeram/clear\_cache
===================

Clear CakePHP caches from shell, app or debug\_kit panel

1.1.0(11y ago)85123.8k↓26.4%16[2 issues](https://github.com/ceeram/clear_cache/issues)3MITPHPPHP &gt;=5.3.0

Since Dec 30Pushed 11y ago12 watchersCompare

[ Source](https://github.com/ceeram/clear_cache)[ Packagist](https://packagist.org/packages/ceeram/clear_cache)[ Docs](http://github.com/ceeram/clear_cache)[ RSS](/packages/ceeram-clear-cache/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (3)Used By (3)

ClearCache plugin for CakePHP
=============================

[](#clearcache-plugin-for-cakephp)

ClearCache plugin provides several ways how to clear CACHE subfolders and cache engines in CakePHP applications.

Requirements
------------

[](#requirements)

The master branch has the following requirements:

- CakePHP 2.0 or greater.
- PHP 5.3.0 or greater.

For CakePHP 1.3 use the 1.3 branch.

Installation
------------

[](#installation)

- Clone/Copy the files in this directory into `app/Plugin/ClearCache`
- Ensure the plugin is loaded in `app/Config/bootstrap.php` by calling `CakePlugin::load('ClearCache');`

Usage
=====

[](#usage)

Console Shell
-------------

[](#console-shell)

Run from your APP folder:

```
# clear all cached files and configured engines
Console/cake ClearCache.clear_cache

# clear all cached files
Console/cake ClearCache.clear_cache files
# clear just files in CACHE folder
Console/cake ClearCache.clear_cache files .
# clear just files in CACHE subfolders
Console/cake ClearCache.clear_cache files *
# clear just files in CACHE/views folder
Console/cake ClearCache.clear_cache files views
# clear just files in selected CACHE subfolders
Console/cake ClearCache.clear_cache files models persistent

# clear all configured cache engines
Console/cake ClearCache.clear_cache engines
# clear just engine named _cake_core_
Console/cake ClearCache.clear_cache engines _cake_core_
# clear just selected engines
Console/cake ClearCache.clear_cache engines default sessions

# clear all configured cache groups
Console/cake ClearCache.clear_cache groups
# clear just cache group named comment
Console/cake ClearCache.clear_cache groups comment
# clear just selected groups
Console/cake ClearCache.clear_cache groups comment post

```

By default, running the shell will only display a total number of items cleaned. Use the `-v` flag to get list of items deleted:

```
# clear all cached files and configured engines
Console/cake ClearCache.clear_cache -v
# clear all cached files
Console/cake ClearCache.clear_cache files -v
# clear just engine named _cake_core_
Console/cake ClearCache.clear_cache engines _cake_core_ -v

```

Library Class
-------------

[](#library-class)

Similarly, run from your application code:

```
App::uses('ClearCache', 'ClearCache.Lib');
$ClearCache = new ClearCache();

$output = $ClearCache->run();

$output = $ClearCache->files();
$output = $ClearCache->files('.');
$output = $ClearCache->files('*');
$output = $ClearCache->files('views');
$output = $ClearCache->files('models', 'persistent');

$output = $ClearCache->engines();
$output = $ClearCache->engines('_cake_core_');
$output = $ClearCache->engines('default', 'custom');

$output = $ClearCache->groups();
$output = $ClearCache->groups('comment');
$output = $ClearCache->groups('comment', 'post');

```

Method files() returns an associative array of deleted/undeleted files:

```
array(
	'deleted' => array(...),
	'error'   => array(...)
)

```

Method engines() returns an associative array of result:

```
array(
	'default' => true,
	'_cake_core_'   => false
)

```

Method groups() returns an associative array of result:

```
array(
	'comment' => array(
		'default' => true,
	),
	'post' => array(
		'default' => true,
		'advanced' => true,
	),
)

```

Method run() returns an associative array of result:

```
array(
	'files' => array(
		'deleted' => array(...),
		'error'   => array(...)
	),
	'engines' => array(
		'default' => true,
		'_cake_core_'   => false
	)
)

```

Panel for DebugKit toolbar
--------------------------

[](#panel-for-debugkit-toolbar)

In AppController, configure usage of ClearCache panel for DebugKit toolbar:

```
public $components = array(
	'DebugKit.Toolbar' => array(
		'panels' => array('ClearCache.ClearCache')
	)
);

```

Optionally, mainly for situations when debug is disabled and DebugKit is configured with `'forceEnable' => true`, it is possible to restrict clearing of CACHE subfolders and cache engines/groups through DebugKit panel to specific items only (string or array of strings under folders/engines/groups keys) and/or enable every ones with special string *all*:

```
public $components = array(
	'DebugKit.Toolbar' => array(
		'panels' => array('ClearCache.ClearCache'),
		'clear_cache' => array(
			// allow to clear just files in CACHE/views folder
			'folders' => 'views'
			// allow to clear all cache engines at once, and selected ones separately
			'engines' => array('_all_', 'default', 'sessions'),
			// allow to clear all cache groups at once, and selected ones separately
			'groups' => array('_all_', 'comment', 'post'),
		)
	)
);

```

Clearing cache groups
---------------------

[](#clearing-cache-groups)

Cache groups were introduced in CakePHP 2.2 and they are shared across all cache configs using the same engine and same prefix. Despite of this, ClearCache plugin clears WHOLE cache groups - even if they're specified in cache configurations with different cache engines and different prefixes.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity46

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 54.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~688 days

Total

2

Last Release

4199d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dce8417c19d15346ceac180ea49567a3c7c7a1b88165e1f47d58796a13991eaf?d=identicon)[Ceeram](/maintainers/Ceeram)

---

Top Contributors

[![stork](https://avatars.githubusercontent.com/u/248924?v=4)](https://github.com/stork "stork (32 commits)")[![ceeram](https://avatars.githubusercontent.com/u/111448?v=4)](https://github.com/ceeram "ceeram (18 commits)")[![rchavik](https://avatars.githubusercontent.com/u/39490?v=4)](https://github.com/rchavik "rchavik (4 commits)")[![tersmitten](https://avatars.githubusercontent.com/u/3392962?v=4)](https://github.com/tersmitten "tersmitten (3 commits)")[![davidyell](https://avatars.githubusercontent.com/u/49889?v=4)](https://github.com/davidyell "davidyell (1 commits)")[![Hyra](https://avatars.githubusercontent.com/u/380836?v=4)](https://github.com/Hyra "Hyra (1 commits)")

### Embed Badge

![Health badge](/badges/ceeram-clear-cache/health.svg)

```
[![Health](https://phpackages.com/badges/ceeram-clear-cache/health.svg)](https://phpackages.com/packages/ceeram-clear-cache)
```

###  Alternatives

[fuel/oil

FuelPHP 1.x Oil Package

1051.2M5](/packages/fuel-oil)[humanmade/orphan-command

WP-CLI command to list and delete orphan WordPress entities and metadata.

4519.1k](/packages/humanmade-orphan-command)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
