[pLog-svn] r2815 - plog/trunk/class/dao

Mark Wu markplace at gmail.com
Wed Jan 18 11:52:27 GMT 2006


Ah... I see.

Still fuzzy, but,... I think I am getting familiar with the cache.

I just did some modification in svn rev 2816. If you have time, please
kindly review it.

Mark

> -----Original Message-----
> From: plog-svn-bounces at devel.lifetype.net 
> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of 
> Oscar Renalias
> Sent: Wednesday, January 18, 2006 3:35 PM
> To: plog-svn at devel.lifetype.net
> Subject: Re: [pLog-svn] r2815 - plog/trunk/class/dao
> 
> The identifiers below are used to identify caches. Each cache 
> has a name and a key, so in the case of categories we've got 
> three caches:
> 
> - CACHE_ARTICLE_CATEGORIES_BLOG: Caches all the categories of 
> a given blog. The key is the blog id.
> - CACHE_ARTICLE_CATEGORIES_LINK: Caches the 
> plog_articles_categories_link table, that is, the m:n 
> relationship between articles and categories. The key is the 
> article id.
> - CACHE_ARTICLE_CATEGORIES_BYNAME: Caches categories given 
> their "mangled name" so that loading of categories when using 
> custom URLs is faster.
> 
> When you for example update a category, you need to make sure 
> that you reset all the relevant caches (or all of them) using 
> the right key. So if you notice that I forgot to do that in 
> ArticleCategories::deleteCategory(), not only do you need to 
> reset CACHE_ARTICLE_CATEGORIES_BLOG but also the other two:
> 
> $this->_cache->removeData( $category->getMangledName(), 
> CACHE_ARTICLE_CATEGORIES_BYNAME );
> 
> Now we also need to think about how to reset 
> CACHE_ARTICLE_CATEGORIES_LINK because we need to know all the 
> articles that reference this category... If it's too 
> difficult, we can remove this cache altogether :)
> 
> Oscar
> 
> 
> On 1/18/06, Mark Wu <markplace at gmail.com> wrote:
> > Hi Oscar;
> >
> > It seems I already fixed the deleteCategory, but I still confuse.
> >
> > There are three cache id in that DAO:
> >
> > CACHE_ARTICLE_CATEGORIES_BYNAME
> > CACHE_ARTICLE_CATEGORIES_BLOG
> > CACHE_ARTICLE_CATEGORIES_LINK
> >
> > In this revision, I just remove the data from the cache gropu 
> > CACHE_ARTICLE_CATEGORIES_BLOG. Will the dirty data (deleted 
> category) 
> > remaining in the other 2 groups? Do I need to worry about that?
> >
> > Mark
> >
> > > -----Original Message-----
> > > From: plog-svn-bounces at devel.lifetype.net
> > > [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of 
> > > mark at devel.lifetype.net
> > > Sent: Wednesday, January 18, 2006 12:12 PM
> > > To: plog-svn at devel.lifetype.net
> > > Subject: [pLog-svn] r2815 - plog/trunk/class/dao
> > >
> > > Author: mark
> > > Date: 2006-01-18 04:11:53 +0000 (Wed, 18 Jan 2006) New Revision: 
> > > 2815
> > >
> > > Modified:
> > >    plog/trunk/class/dao/articlecategories.class.php
> > > Log:
> > > Now the deleteCategory works better.
> > >
> > > Modified: plog/trunk/class/dao/articlecategories.class.php
> > > 
> ===================================================================
> > > --- plog/trunk/class/dao/articlecategories.class.php
> > > 2006-01-18 03:48:40 UTC (rev 2814)
> > > +++ plog/trunk/class/dao/articlecategories.class.php
> > > 2006-01-18 04:11:53 UTC (rev 2815)
> > > @@ -214,8 +214,11 @@
> > >          function deleteCategory( $categoryId, $blogId )
> > >          {
> > >               $category = $this->getCategory( 
> $categoryId, $blogId );
> > > -             if( $category )
> > > -                     return( $this->delete( "id", $categoryId ));
> > > +             if( $category ) {
> > > +                             if ( $this->delete( "id",
> > > $categoryId ) )
> > > +
> > > $this->_cache->removeData( $blogId,
> > > CACHE_ARTICLE_CATEGORIES_BLOG );
> > > +                     return( true );
> > > +             }
> > >               else
> > >                       return( false );
> > >          }
> > >
> > > _______________________________________________
> > > pLog-svn mailing list
> > > pLog-svn at devel.lifetype.net
> > > http://devel.lifetype.net/mailman/listinfo/plog-svn
> >
> > _______________________________________________
> > pLog-svn mailing list
> > pLog-svn at devel.lifetype.net
> > http://devel.lifetype.net/mailman/listinfo/plog-svn
> >
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn



More information about the pLog-svn mailing list