in the same link that you provided, check the comments for more details

On Sun, Dec 5, 2010 at 4:14 PM, Bart <bart.gloudem...@gmail.com> wrote:

> This is what I'm referring to:
> http://book.cakephp.org/view/348/Clearing-the-Cache
>
> (couldn't find it earlier, sorry)
>
>
>
> On Dec 5, 10:03 pm, Bart <bart.gloudem...@gmail.com> wrote:
> > It's not Cache:write() that is not behaving as expected.
> >
> > It's $this->Post->save() that is not behaving as expected.
> > I expect it to delete all cache-files that are related to that
> > particular Post.
> > But it doesn't.
> >
> > On Dec 5, 9:22 pm, "Ma'moon" <phpir...@gmail.com> wrote:
> >
> > > If the cache file does exist && not expired then CakePHP won't
> overwrite it
> > > until "at least" one of those 2 conditions remains true, otherwise you
> have
> > > to manually delete the cache file and create it, your save operation is
> not
> > > changing any of those 2 conditions (removing the original cache file or
> > > changing its expiry) and hence Cache::write won't behave as you
> expected!
> > > On the other hand, as soon as the target cache file gets expired,
> > > Cache::write() will automatically overwrite the file with the new
> content!
> >
> > > On Sun, Dec 5, 2010 at 2:57 PM, Bart <bart.gloudem...@gmail.com>
> wrote:
> > > > Extra context: writing the cache happens only in the view-action,
> when
> > > > a visitor sees the blog.
> > > > I'm not trying to write during the edit-action, I only save/update to
> > > > the model. So the Cache::write() and $this->Post->save() happen in 2
> > > > separate actions.
> >
> > > > I simply expected the cache to be deleted on $this->Post->save();
> > > > Has this changed since 1.2?
> >
> > > Because then the cache-file got deleted automatically on $this->Post-
> >
> > > > >save();
> > > > (AND when it expired, but that's a less relevant here).
> >
> > > > thanks for your reaction!
> > > > I will try it.
> >
> > > > bart
> >
> > > > On Dec 5, 8:45 pm, "Ma'moon" <phpir...@gmail.com> wrote:
> > > > > Cache files needs to be explicitly deleted by calling
> Cache::delete() ,
> > > > make
> > > > > sure to call it BEFORE calling Cache::write()
> >
> > > > > On Sun, Dec 5, 2010 at 2:41 PM, Bart <bart.gloudem...@gmail.com>
> wrote:
> > > > > > Yes, definately. The cache-file is already created (because of
> > > > > > Cache::write() ) and I can see it appear in my filesystem.
> > > > > > The way I write the cache is as follows :
> >
> > > > > > $post = null;
> > > > > > if( ($post = Cache::read('post_'.$id)) === false ){
> > > > > >        $post = $this->Post->find('first',
> > > > > > array(  'conditions'=>array('Post.id'=>$id,
> 'Post.published'=>true),
> >
> > > > > >                    'contain'=>array(
> >
> > > > > >                                            'ChildPost' => array(
> >
> > > > > >                                                    'conditions'
> =>
> > > > > > array('published'=>true),
> >
> > > >  'Author','Attachment'
> >
> > > > > >
>  ),'Category','Attachment') )
> > > > );
> > > > > >        Cache::write('post_'.$id, $post);
> > > > > > }
> > > > > > $this->set('post',$post);
> >
> > > > > > On Dec 5, 8:35 pm, "Ma'moon" <phpir...@gmail.com> wrote:
> > > > > > > Are you sure that you are calling Cache::write() ?
> >
> > > > > > > On Sun, Dec 5, 2010 at 2:28 PM, Bart <
> bart.gloudem...@gmail.com>
> > > > wrote:
> > > > > > > > Hi,
> >
> > > > > > > > I'm using CakePHP 1.3.6.
> > > > > > > > I'm caching queries that retrieve single Posts in my
> controller.
> > > > The
> > > > > > > > cache files are created nicely and I use the default
> > > > Cache::config().
> > > > > > > > Now I expect my cache component to delete the cache file as
> soon as
> > > > I
> > > > > > > > edit and save the post. But that doesn't happen.
> >
> > > > > > > > I have tried all debug modes (0,1,2)
> > > > > > > > I also tried to use the syntax where the id of the Post is
> included
> > > > in
> > > > > > > > the data-array or when it is delivered by saying:
> > > > > > > > $this->Post->id = $id;
> > > > > > > > prior to the save action.
> > > > > > > > The cache files that are created have permission code 666.
> (might
> > > > that
> > > > > > > > be the problem?)
> >
> > > > > > > > Does anyone have an idea what's going wrong?
> > > > > > > > Thanks a lot!
> > > > > > > > Bart
> >
> > > > > > > > Check out the new CakePHP Questions
> sitehttp://cakeqs.organdhelp
> > > > > > 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<cake-php%2bunsubscr...@googlegroups.com>
> <cake-php%2bunsubscr...@googlegroups.com<cake-php%252bunsubscr...@googlegroups.com>
> >
> > > > <cake-php%2bunsubscr...@googlegroups.com<cake-php%252bunsubscr...@googlegroups.com>
> <cake-php%252bunsubscr...@googlegroups.com<cake-php%25252bunsubscr...@googlegroups.com>
> >
> >
> > > > > > <cake-php%2bunsubscr...@googlegroups.com<cake-php%252bunsubscr...@googlegroups.com>
> <cake-php%252bunsubscr...@googlegroups.com<cake-php%25252bunsubscr...@googlegroups.com>
> >
> > > > <cake-php%252bunsubscr...@googlegroups.com<cake-php%25252bunsubscr...@googlegroups.com>
> <cake-php%25252bunsubscr...@googlegroups.com<cake-php%2525252bunsubscr...@googlegroups.com>
> >
> > > > >>For
> > > > > > more options, visit this group at
> > > > > > > >http://groups.google.com/group/cake-php?hl=en
> >
> > > > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> > > > 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<cake-php%2bunsubscr...@googlegroups.com>
> <cake-php%2bunsubscr...@googlegroups.com<cake-php%252bunsubscr...@googlegroups.com>
> >
> > > > <cake-php%2bunsubscr...@googlegroups.com<cake-php%252bunsubscr...@googlegroups.com>
> <cake-php%252bunsubscr...@googlegroups.com<cake-php%25252bunsubscr...@googlegroups.com>
> >>For
> > > > more options, visit this group at
> > > > > >http://groups.google.com/group/cake-php?hl=en
> >
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp
> 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<cake-php%2bunsubscr...@googlegroups.com>
> <cake-php%2bunsubscr...@googlegroups.com<cake-php%252bunsubscr...@googlegroups.com>>For
> more options, visit this group at
> > > >http://groups.google.com/group/cake-php?hl=en
>
> 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<cake-php%2bunsubscr...@googlegroups.com>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

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