class Forms extends AppModel {
public $primaryKey = 'id';
public function afterSave($created) {
parent::afterSave($created);
Cache::clear();
clearCache();
}
public function afterDelete() {
parent::afterDelete();
Cache::clear();
clearCache();
}
public function getFormsById($id){
if (($form = Cache::read('getFormsById'.$id)) === false) {
$form = $this->find('first', array('conditions' => array('Forms.id'=>$id,'Forms.site_id'=> Configure::read('Settings.site_id'))));
Cache::write('getFormsById'.$id, $form);
}
return $form;
}
}
Hope this helps. I am new to Cake cache so if I am wrong someone please feel free to point it out
High Octane Brands LLC
"Building Brands Not Just Business"
-- Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment