For my paginated result sets I have 2 types of keys. The total number of records and a key for each page of the result set. If any changes are made to that result set, I delete the total key. My code knows if the total key isn't found, it needs to grab a new result set.

That also makes it easy for me to update the result set from a different location of the code base, since I only have to know about 1 key and keep track of that.

There are many other methods, but this is what I personally use and it seems to do ok.

On Sep 16, 2008, at 10:59 AM, dantro wrote:


dear memcache fans

i am looking for a solution nearly a week. my problems deals with
memcache and pagination.

for example (without memcache):
my site offers the possibility to post comments. if an user looks at
the comments site i query
the database via "SELECT [..] LIMIT x,y". per page I am showing 20
comments. If I have 100
comments it leads to 5 pages a 20 comments.
Now I am looking for a solution to put these comments into memcache
parallel to mysql.
I don't know, understand how to deal with memcache if a comments get
deleted or added.
I want to prevent querying the whole comments list ("SELECT id,...
WHERE forumid=$fid").

Do you have any solutions or what are your setups to handle memcache
and mysql pagination
with "LIMIT x,y" when you add or delete entries.

Thank you very much for helping..
I really tried to find practical solutions!


Dan

Reply via email to