Use the code construction as defined in the CakePHP book at:
http://book.cakephp.org/view/767/Cache-write
where the code first ask for the data from the cache and upon a false
result, requests the data from the model, and fills the cache with the
models result.
Hope this helps you on the way,
   John

On Feb 13, 10:01 pm, "Dave" <make.cake.b...@gmail.com> wrote:
> I want to add this in my User model for registrations checking for banned
> words type thing.
>
>   $params = array(
>    'contain' => false,
>    'fields' => array(
>     'Restriction.id',
>     'Restriction.name'));
>
>   $restrictions = Cache::read('restrictions_cache', 'long');
>
>   if (empty($restrictions))
>   {
>    Controller::loadModel('Restriction');
>    $restrictions = $this->Restriction->find('list' , $params);
>    Cache::write('restrictions_cache', $restrictions,'long');
>   }
>
> But how do I search the cache for data?
>
> Right now I  have this to check the table but since the data in Restrictions
> never changes I just want to cache the data and do my find with the cached
> data.
>
> $q = $this->Restriction->find('first' , array('conditions' => array(
> 'Restriction.name LIKE' => $value)));
>
> Thanks
>
> Dave

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to