Lithium PHP
Helper/Model caching plugin forWill aid in the caching of expensive helper/model instance methods.
Installation
Composer
{
"require": {
...
"blainesch/li3_memoize": "dev-master"
...
}
}
php composer.phar install
Submodule
git submodule add git://github.com/BlaineSch/li3_memoize.git libraries/li3_memoize
Clone Directly
git clone git://github.com/BlaineSch/li3_memoize.git libraries/li3_memoize
Usage
Load the plugin
Add the plugin to be loaded with Lithium's autoload magic
In app/config/bootstrap/libraries.php
add:
<?php
Libraries::add('li3_memoize');
?>
Tell it which instance methods to cache
<?php
use li3_memoize\extensions\Memoize;
Memoize::add(array(
array(
'name' => 'app\extensions\helper\Prose',
'method' => array('init')
),
array(
'name' => 'app\models\Users',
'method' => array('name')
),
));