Multiget/intelligent generic PHP wrapper function... thoughts/advice wanted

mike mike503 at
Thu Nov 1 00:40:33 UTC 2007

On 10/31/07, Dustin Sallings <dustin at> wrote:
>        That's not necessary, though.  You know what you asked for and you
> know what you've got.  The set-theoretic difference is what you
> didn't get.
>        Of course, your client can compute that for you if you want it to.

Yes, but with key prefixes not matching the database keys, I have to
change the key indexes in PHP back and forth to suit the needs. Is
there a better way? Not to mention I have to assign the key name of
the to be the whole key name, or the array_diff_key/related functions
can't do a diff properly.

This seems horribly redundant:
$cache_keys[$prefix.$key] = $prefix.$key;

the memcache_get wants the parameters in the array VALUES, where
array_diff_key() wants array KEY and memcache_get returns the key name
in the KEY as well. Aligning them requires reiteration - a total of 3
iterations in my current code. I am quite sure I can cut it down to 2
somehow. Possibly also do more optimal looping...

More information about the memcached mailing list