[pLog-svn] Object cache bug -- Jon metioned about 1 or 2 months ago

Mark Wu markplace at gmail.com
Fri Sep 22 06:36:31 GMT 2006


Hi Oscar and Jon:
 
I think I found the bug that Jon metioned in 1 or 2 month ago about the
order of comments...
 
He sets the comments order from oldest to newset, but sometimes he will get
the newset from oldest in front page... 
 
I think it is the bug of obect cache  mechanisim...
 
You can reproduce the bug in the followings steps
 
1. Change your comments order in blog settings  to "from oldest to newest"
2. Clean your /tmp cache (DOT OPEN ANY FRONT PAGE RIGHT NOW)
3. Go to edit posts and choohse one post that has comments (at least 2
comments, or you can not see the different), and click CM field in that
post. You will see your comments of this post list from newest to oldest (It
is the default behavior of this view)
4. Now, you can open your permalink of that post,.... you will see your
comments list from "newest to oldest" not from "oldest to newest"
 
Why this happend?
 
Because we do not cache the objects order in array. We just check the cache
does exist or not, we never check the "Order" of the objects is right or
not.
 
So, how to solve this problem?
 
1. Seperate the cache constatnt to two, if we have oders in parameters, for
example, we can seperate
 
define( "CACHE_ARTICLE_COMMENTS_BYARTICLE", "article_comments_byarticle" );
 
to
 
define( "CACHE_ARTICLE_COMMENTS_BYARTICLE_NEWEST_TO_OLDEST",
"article_comments_byarticle_newest_to_oldest" );
define( "CACHE_ARTICLE_COMMENTS_BYARTICLE_OLDEST_TO_NEWEST",
"article_comments_byarticle_oldest_to_newest" );
 
2. Or we just apply array sort of the objects cache. But one problem is if
the cache only keeps parts of objects becasue the paging .... this way won't
works :(
 
So, maybe option 1 is the way to go.
 
Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http:// devel.lifetype.net/pipermail/plog-svn/attachments/20060922/9bc7f8f7/attachment.html


More information about the pLog-svn mailing list