Giter Club home page Giter Club logo

cacher's People

Contributors

jeremyharris avatar joshcarlson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cacher's Issues

Installation Setting Error (Detail Configuration)

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

  1. I extract downloaded file and put in Plugin/Cacher
  2. I go to Config/bootsrap.php and add CakePlugin::load('Cacher');
  3. I added in Model/AppModel.php this code : public $actsAs = array('Cacher.Cache');
  4. I added in my Controller : $this->paginate = array('fields'=>array('id','name'),'cacher' => '+1 day'); . (I added in my index function)
  5. But show this error : "Declaration of CacheSource::read() should be compatible with DataSource::read(Model $model, $queryData = Array, $recursive = NULL) [APP\Plugin\Cacher\Model\Datasource\CacheSource.php, line 208]"

Are there wrong procedures ? :(

Disabling cache for a query after setting auto=true does not work

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.

For best performance

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']);
}

}

Paginate with containable doesn't work

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?

Many Errors

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?

Invalidate parent if child is updated

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?

Error on Cache disabled

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.