why not update the memcached while update db?
At 2012-03-13 16:35:37,"陈 宗志" <[email protected]> wrote: Our Inc has meet a Problem. Our memcached use the read through.when the items is expire. Then a lot of request will visit the DB(mysql) direct. It will cause the mysql lots of slow query, even to make the mysql die. So I have a idea about it. we can add a key buffer in memcached. When client is get a key, and memcached can't find the key. Then memcached check if the key is in the key buff. If it isn't in the key buffer, then Set the key in the key buffer. And the client do a set command to set the key(This will visit the DB,and we can have a default expire time 3600). Then return the result and clear the buffer in key buffer. If it is in the key buffer, then we will sleep for 1 second. Then check memcached again until it return the value. This is just my idea.Can you give me suggestion? -- Blog: http://www.chenzongzhi.info Twitter: https://twitter.com/baotiao Git: https://github.com/baotiao
