How do I store all the entries from a mysql table in memcache?
Suppose I have a table with over a million entries and I want to store all of them into the memory using memcache. Would it be possible to retrieve all or any of these records without querying MySQL using the SELECT statement? If it is possible, what should I do (using PHP) t开发者_C百科o accomplish this?
Here are my thoughts:
- mysql doesn't read from disk on each cache - it also has cache the data in the memory (but it need to be tuned, there is no any magic configuration that works well in any case)
- if you don't need mysql and you think that you'll be good without sql queries - move to redis/couchdb/mongodb
- cache the things requested often. you don't need waste memory with all 1M records while only 1% of them is requested often - so cache only things need to be cached
- mysql itself is a good and fast enough storage - with proper indexes handling of 1M records shouldn't be a problem at all
精彩评论