jeremyharris / cacher Goto Github PK
View Code? Open in Web Editor NEWA CakePHP caching plugin that caches query results. Only requires attaching a behavior.
A CakePHP caching plugin that caches query results. Only requires attaching a behavior.
Hello, I can't found installation documentation here
I install this plugin in cakephp 2.3.4, I use the fresh code not edited. (first installation after change security salt and configure database) no change more
Are there wrong procedures ? :(
Hi
cache cleaning does not work when using the methods
deleteAll() and updateAll()
We cannot disable cache for a query after setting auto=true in model. Because setting cacher=false for a query will always be overridden by following code::
$this->cacheResults = $this->cacheResults || $this->settings[$Model->alias]['auto'];
//at line no. 106 of behavior
And I believe this issue will also affect the vice-versa case. I suggest putting a 'else' case to: if (isset($queryData['cacher'])), so it will only use default setting if not specified for that particular query.
This code for best performance: CacheSource.php
protected function _map($Model, $key) {
$modelName = $Model->alias;
$map = Cache::read('map', $this->config['config']);
if ($map === false) {
$map = array();
}
if(!isset($map[$modelName])){
$map[$modelName] = array();
}
if(!isset($map[$modelName][$key])){
$map[$modelName][$key] = $key;
Cache::write('map', $map, $this->config['config']);
}
}
public function clearModelCache(Model $Model, $query = null) {
$modelName = $Model->alias;
$map = Cache::read('map', $this->config['config']);
if ($map === false) {
$map = array();
}
$keys = array();
if ($query !== null) {
$keys = array($this->_key($Model, $query));
} else{
if(isset($map[$modelName])){
$keys = $map[$modelName];
}
}
if (empty($keys)) {
return;
}
if ($query !== null) {
unset($map[$modelName]);
Cache::write('map', $map, $this->config['config']);
foreach ($keys as $cacheKey) {
Cache::delete($cacheKey, $this->config['config']);
}
}else{
foreach ($keys as $cacheKey) {
Cache::delete($cacheKey, $this->config['config']);
unset($map[$modelName][$cacheKey]);
}
Cache::write('map', $map, $this->config['config']);
}
}
saveField doesnt fireup clearCache
Hi,
I have the folowing setting into my Paginate settings :
'contain' => array('User' => array('fields'=> array('username'))),
Pagination works well with it, but since i have:
'contain' => array('User' => array('fields'=> array('username'))),
''cacher' => '+1 minute
i got the error msg Undefined index: User . It seems that the Cacher breaks containable.... Is there a way to figure out?
Strict (2048): Declaration of CacheBehavior::setup() should be compatible with ModelBehavior::setup(Model $model, $config = Array) [APP/Plugin/Cacher/Model/Behavior/CacheBehavior.php, line 180]
Strict (2048): Declaration of CacheBehavior::beforeFind() should be compatible with ModelBehavior::beforeFind(Model $model, $query) [APP/Plugin/Cacher/Model/Behavior/CacheBehavior.php, line 180]
Strict (2048): Declaration of CacheBehavior::beforeSave() should be compatible with ModelBehavior::beforeSave(Model $model) [APP/Plugin/Cacher/Model/Behavior/CacheBehavior.php, line 180]
Strict (2048): Declaration of CacheBehavior::beforeDelete() should be compatible with ModelBehavior::beforeDelete(Model $model, $cascade = true) [APP/Plugin/Cacher/Model/Behavior/CacheBehavior.php, line 180]
Strict (2048): Declaration of CacheSource::read() should be compatible with DataSource::read(Model $model, $queryData = Array) [APP/Plugin/Cacher/Model/Datasource/CacheSource.php, line 207]
Ubuntu 12.04 + Cakephp 2.2 + PHP 5.4
It was working very good before upgrading php to 5.4.
Any ideas how to fix it?
We're going to start work on figuring out how to solve this issue. For us if someone updates a ProductImage we need Product to reflect that on save. In the README you mention that some ideas have been tossed around.
Mind sharing what those were and we can hash out a solution?
if you disable the cache, the variable source is a null when it does read in the datasource.
if i move the line:
$this->source = ConnectionManager::getDataSource($this->config['original']);
before the test:
if (Configure::read('Cache.disable') === true) {
it's OK
I saw your Notes
https://github.com/jeremyharris/cacher#notes
was wondering what are the various solutions suggested and the pros and cons?
I am interested to use the plugin so I am hoping to have more info about such gotchas.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.