Sanity check please! PHP/memcached strategy

mike mike503 at gmail.com
Sat Oct 27 00:17:56 UTC 2007


On 10/26/07, Dustin Sallings <dustin at spy.net> wrote:
>
>    Pipelining won't help when you're waiting for the response to one
> before sending a second request.
>
>    Note that you'd also do 50 db requests with your current code.  The
> trick is to group them sensibly.
>
>    After you find out what IDs you need, ask for them all at once.
> Figure out which ones you didnt get (set difference) and do a db query
> with an "in" clause for all of those at once.  Then set them
> individually back into the cache.

yeah, i was expecting a hit of 50 queries at once, but after that
there should be zero for that set.

does anyone have any example code when dealing with lists like this?
just build an array of IDs, and then do some sort of
asset_multiget($array) which does a cache_multiget of the IDs, ...
hmm. that gets confusing then. because i will need to track
hits/misses. that's why i think i liked the single row approach,
because hits and misses can be mixed and i am none the wiser...

i'd be curious (and grateful) to see anyone's approaches which seem
appropriate to deal with a multiple get/multiple row matches...

thanks!


More information about the memcached mailing list