PHPackages                             consik/yii2-cachecleaner - 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. [Caching](/categories/caching)
4. /
5. consik/yii2-cachecleaner

ActiveYii2-extension[Caching](/categories/caching)

consik/yii2-cachecleaner
========================

Yii2 behavior for deleting cache values on component event

1.1.0(9y ago)29MITPHP

Since Dec 8Pushed 9y agoCompare

[ Source](https://github.com/consik/yii2-cachecleaner)[ Packagist](https://packagist.org/packages/consik/yii2-cachecleaner)[ RSS](/packages/consik-yii2-cachecleaner/feed)WikiDiscussions master Synced 4w ago

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

Yii2 CacheCleaner Extension
===========================

[](#yii2-cachecleaner-extension)

[![Latest Stable Version](https://camo.githubusercontent.com/febe0c8e3d9e4be3e546a6181f596b67702c428886799590869de3f8af15307c/68747470733a2f2f706f7365722e707567782e6f72672f636f6e73696b2f796969322d6361636865636c65616e65722f762f737461626c65)](https://packagist.org/packages/consik/yii2-cachecleaner)[![Total Downloads](https://camo.githubusercontent.com/bb283c337d77d3d9ee7454b55bce58e2ef218c468f013b626e6f9295ec678d25/68747470733a2f2f706f7365722e707567782e6f72672f636f6e73696b2f796969322d6361636865636c65616e65722f646f776e6c6f616473)](https://packagist.org/packages/consik/yii2-cachecleaner)[![License](https://camo.githubusercontent.com/2d31ef77ce999d80b6a5dcb32543d823090f29563722ba03b17fd2274be69d34/68747470733a2f2f706f7365722e707567782e6f72672f636f6e73696b2f796969322d6361636865636c65616e65722f6c6963656e7365)](https://packagist.org/packages/consik/yii2-cachecleaner)

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require consik/yii2-cachecleaner

```

or add

```
"consik/yii2-cachecleaner": "^1.0"
```

CacheCleanerBehavior class description
--------------------------------------

[](#cachecleanerbehavior-class-description)

Deletes cache after defined events.

### Properties

[](#properties)

1. ` array $events = []` - Associative array where key is event name, value(array|string|null) is a cache key(s) to delete
2. ` string $cacheComponent = 'cache'` - Name of the application cache component

### Public methods

[](#public-methods)

1. ` boolean deleteCache(string|array $key)` - Deletes cache value(s)
2. ` boolean flushCache()` - Deletes all cache values

ARUpdateCCBehavior class description. [\#docs](/ARUpdateCCBehavior.php#L18)
---------------------------------------------------------------------------

[](#arupdateccbehavior-class-description-docs)

Deletes cache values after updating ActiveRecord attributes

### Properties

[](#properties-1)

1. ` array $attributes = []` - Associative array, where array keys is attributes name, array value is cache value(s) keys
2. ` string $cacheComponent = 'cache'` - Name of the application cache component

See [DocBlock](/ARUpdateCCBehavior.php#L18) for usage examples.

Examples
--------

[](#examples)

### Autodelete cache after AR update

[](#autodelete-cache-after-ar-update)

Simple use case: We have cached AR object somewhere in our app:

```
