PHPackages                             imsamurai/cakephp-caching-behavior - 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. imsamurai/cakephp-caching-behavior

ActiveCakephp-plugin[Caching](/categories/caching)

imsamurai/cakephp-caching-behavior
==================================

Use it if you want to wrap model methods with cache

1.0.0(12y ago)318MITPHP

Since Feb 7Pushed 12y ago1 watchersCompare

[ Source](https://github.com/imsamurai/cakephp-caching-behavior)[ Packagist](https://packagist.org/packages/imsamurai/cakephp-caching-behavior)[ Docs](http://github.com/imsamurai/cakephp-caching-behavior)[ RSS](/packages/imsamurai-cakephp-caching-behavior/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

CakePHP Caching Behaviour
=========================

[](#cakephp-caching-behaviour)

[![Build Status](https://camo.githubusercontent.com/5c7eeb7a3cfb3c41e24b5b69aef534a2485e04d2ae55d960f3045d108fae55ad/68747470733a2f2f7472617669732d63692e6f72672f696d73616d757261692f63616b657068702d63616368696e672d6265686176696f722e706e67)](https://travis-ci.org/imsamurai/cakephp-caching-behavior) [![Coverage Status](https://camo.githubusercontent.com/f9a34f181d35f2806d8eb078731628907a38f7e8a039f853ecc7f8d2d7bbd780/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f696d73616d757261692f63616b657068702d63616368696e672d6265686176696f722f62616467652e706e673f6272616e63683d6d6173746572)](https://coveralls.io/r/imsamurai/cakephp-caching-behavior?branch=master) [![Latest Stable Version](https://camo.githubusercontent.com/438b3b1c2fffb81b693a8c2c32d375044f890436a488941de9af9b833ca231fa/68747470733a2f2f706f7365722e707567782e6f72672f696d73616d757261692f63616b657068702d63616368696e672d6265686176696f722f762f737461626c652e706e67)](https://packagist.org/packages/imsamurai/cakephp-caching-behavior) [![Total Downloads](https://camo.githubusercontent.com/4f2e76ed627bee25c418deea121f9bb2b752252291fe656b880813e81525393c/68747470733a2f2f706f7365722e707567782e6f72672f696d73616d757261692f63616b657068702d63616368696e672d6265686176696f722f646f776e6c6f6164732e706e67)](https://packagist.org/packages/imsamurai/cakephp-caching-behavior) [![Latest Unstable Version](https://camo.githubusercontent.com/86f72b9e1f7c59deee037ff5fa1335d6512a727d1445846f488f99a8a240b24d/68747470733a2f2f706f7365722e707567782e6f72672f696d73616d757261692f63616b657068702d63616368696e672d6265686176696f722f762f756e737461626c652e706e67)](https://packagist.org/packages/imsamurai/cakephp-caching-behavior) [![License](https://camo.githubusercontent.com/0e9c603d0ecae6e608935a0d4a739e52e31645575c32e8838304d34b9d877943/68747470733a2f2f706f7365722e707567782e6f72672f696d73616d757261692f63616b657068702d63616368696e672d6265686176696f722f6c6963656e73652e706e67)](https://packagist.org/packages/imsamurai/cakephp-caching-behavior)

Caching Behaviour for CakePHP 2.1+

Use it if you want to wrap model methods with cache. For example you can use this for heavy model methods, that can't change output value for some time, but you need to invoke them very often.

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

[](#installation)

```
cd my_cake_app/app
git clone git://github.com/imsamurai/cakephp-caching-behavior.git Plugin/Caching

```

or if you use git add as submodule:

```
cd my_cake_app
git submodule add "git://github.com/imsamurai/cakephp-caching-behavior.git" "app/Plugin/Caching"

```

then add plugin loading in Config/bootstrap.php

```
CakePlugin::load('Caching');

```

Configuration
-------------

[](#configuration)

Attach behaviour to model:

```
public $actsAs = array(
      'Caching.Caching' => array(
        'cache' => , // optional
		'cachedObject' =>  // optional
      )
);

```

If cache is not specified in config and method `cache()` used 'default' cache config. By default for 'cachedObject' used 'Caching.CachedObject' that stored in Lib folder. You can use your own class, that must be in Lib folder of app or plugin. But remember that your class must have same interface.

Usage
-----

[](#usage)

After attaching behavior to your model you can do (assuming your model has methods `something()` and `somethingElse()`):

```
$Model->cached()->something(/*args*/);

```

or

```
$Model->cached(/*cache name*/)->something(/*args*/);

```

or

```
$CachedModel = $Model->cached(/*cache name or empty*/);
$CachedModel->something(/*args*/);
$CachedModel->somethingElse(/*args*/);

```

`$Model->cached()` returns object-wrapper that use magick methods and caching. So if expire date is ok, and you invoke same cached methods with same arguments and same cache config then model method calls only once.

###  Health Score

28

—

LowBetter than 51% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

4571d ago

### Community

Maintainers

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

---

Top Contributors

[![imsamurai](https://avatars.githubusercontent.com/u/843002?v=4)](https://github.com/imsamurai "imsamurai (4 commits)")

---

Tags

cakephpcachingbehaviour

### Embed Badge

![Health badge](/badges/imsamurai-cakephp-caching-behavior/health.svg)

```
[![Health](https://phpackages.com/badges/imsamurai-cakephp-caching-behavior/health.svg)](https://phpackages.com/packages/imsamurai-cakephp-caching-behavior)
```

###  Alternatives

[wp-media/wp-rocket

Performance optimization plugin for WordPress

7591.4M4](/packages/wp-media-wp-rocket)[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.6k10](/packages/helsingborg-stad-municipio)[october/rain

October Rain Library

1601.7M103](/packages/october-rain)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45844.8k1](/packages/pressbooks-pressbooks)[mediawiki/maps

Adds various mapping features to MediaWiki

85155.1k3](/packages/mediawiki-maps)[dereuromark/cakephp-cache

A CakePHP plugin for view caching with configurable strategies

3342.3k1](/packages/dereuromark-cakephp-cache)

PHPackages © 2026

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