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

Chris Goffinet goffinet at yahoo-inc.com
Sat Nov 3 04:30:53 UTC 2007


Yes because doing a hash lookup is much faster than looping +  
str_replace. You increase memory but that is the tradeoff.


Chris Goffinet
goffinet at yahoo-inc.com



On Nov 2, 2007, at 9:24 PM, mike wrote:

> On 11/2/07, Chris Goffinet <goffinet at yahoo-inc.com> wrote:
>> Maybe I am missing something here but you dont like having to do
>> str_replace...I agree its stupid.
>>
>> Why not add:
>>                $cache_keys_prefix[$prefix.$key] = $prefix.$key;
>>               $cache_keys[$prefix.$key] = $key;
>>
>> $need_array = array_diff_key($cache_keys_prefix, $cache_array);
>>
>> foreach( $need_array as $key => $value)
>> {
>>  $query_keys .= "," . $cache_keys[$key];
>> }
>> $query_keys[0] = ""; // remove first comma
>
> So you're basically telling me to setup two separate arrays at first,
> if I understand this right?



More information about the memcached mailing list