A couple of comments:

1. Is the order of comments in the list (the way it is shown to a user) user
defined or is it always ordered by timestamp, most recent first? If latter,
than you can store pages of comments. So if forum id is 123, then keys will
be constructed as (123_0, 123_1, 123_2). If comments are added or removed,
then of course you need to
invalidate all the keys associated with that topic. If order is user
defined, meaning that pages may differ depending on who is looking at them,
then it's more tricky of course, because you need to keep the whole list in
memcache (and sort/create pages in memory), but you may not be able to keep
the whole thing because of memcache size limitations.


2. Just curious: what is your concern about running the whole comments list
query every time someone adds/removes comment? I assume there is still much
muc fewer reads than writes and you may still get tremendous gain even if
you invalidate the entire cache every time a topic is touched.
Is this query expensive?  If yes, then have you looked at query plan? Also,
how many comments on average are there in a forum? Hundreds? Tens?

Boris

On Tue, Sep 16, 2008 at 1:59 PM, dantro <[EMAIL PROTECTED]> 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
>



-- 
--Boris

Reply via email to