private function clear_cache(){
    $cleared = clearCache('element__latest_news', 'views', '');
    if(!$cleared) $this->log('Unable to clear cache.');
  }

Worked like a charm!  I didn't know basics had a clearCache function,
I was looking in the Cache class.  Thanks for that tip.

Nick
On Feb 7, 10:45 am, mscdex <[email protected]> wrote:
> Try using the clearCache function instead, as documented 
> here:http://api.cakephp.org/file/basics.php#function-clearCache
> Also, be sure to check the return values of these functions to see if
> it is in fact saying it was successful or not.
>
> On Feb 7, 2:10 am, nurvzy <[email protected]> wrote:
>
> > So I've been reading documentation and looking through source and API
> > and I thought I'm doing the clearing of cache correctly but I'm a
> > little stumped as to why my element cache is not being cleared.
>
> > I have a blog controller and whenever I add or edit a blog I want the
> > element->latest_news to be cleared from the cache.
>
> > So I do something like this in the controller:
>
> > if($Blog->save($this->data)){
> >   $this->clear_cache();
> >   // --- other stuff
>
> > }
>
> > private function clear_cache(){
> >   Cache::delete('latest_news');
>
> > }
>
> > But the tmp/view/elements/element__latest_news file is still there.
> > I'm apparently doing something wrong, maybe because its 1 in the
> > morning and I've had a drink or two but I'm stumped.  Help?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to