Memcached implementation inquiry

Marcus Bointon marcus at
Thu Apr 19 16:54:11 UTC 2007

On 19 Apr 2007, at 17:41, Michael Firsikov wrote:

> However, one of the main reasons to explore memcache for us, were the
> searches. (The complexity of searches in MySQL (a myriad of joins,  
> etc)
> resulted in sub-par performance). I am pretty certain it is against
> memcached best practices, but I have done a basic loop to get thru  
> roughly
> 600K records, get and check a value.

I think you have indeed got the wrong end of the stick. Memcached  
doesn't search, but it can store the results of searches that can be  
indexed and retrieved again. So say you do one of your expensive  
searches - and you are still going to have to do it at least once as  
this is a cache, not a DB - hash the SQL that was used to do it to  
make a key, and store the result as a series of IDs of the matching  
records. Then do a batch get for the value ids (which you have  
preloaded). You can store thousands of different searches this way.

Marcus Bointon
Synchromedia Limited: Creators of
UK resellers of info at hand CRM solutions
marcus at |

More information about the memcached mailing list