开发者

How do I store all the entries from a mysql table in memcache?

开发者 https://www.devze.com 2023-04-01 12:26 出处:网络
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 u

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:

  1. 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)
  2. if you don't need mysql and you think that you'll be good without sql queries - move to redis/couchdb/mongodb
  3. 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
  4. mysql itself is a good and fast enough storage - with proper indexes handling of 1M records shouldn't be a problem at all
0

精彩评论

暂无评论...
验证码 换一张
取 消