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" <[email protected]> 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 <[email protected]> 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" <[email protected]> wrote:
> > > Are you sure that you are calling Cache::write() ?
>
> > > On Sun, Dec 5, 2010 at 2:28 PM, Bart <[email protected]> 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 [email protected]
> > > > To unsubscribe from this group, send email to
> > > > [email protected]<cake-php%[email protected]>
> > <cake-php%[email protected]<cake-php%[email protected]>>For
> > more options, visit this group at
> > > >http://groups.google.com/group/cake-php?hl=en
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<cake-php%[email protected]>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 [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