主要缓存关系数据库查询结果,要定时刷新,清除,没必要备份,
我打算用 memcache,大家推荐,thanks
JAMES: Yeah, it’s correct. I actually am pretty familiar with Memcached/Redis scenario. So, Redis is great and I love Redis and it does lots of different names. But using it as a cache like Memcached is, is really dumb in my opinion because like Katrina says, it’s not as easy to just set a boundary. And what’s way worse is Redis’ expiration of keys. It’s not near as intelligent as Memcached’s expiration of keys. Memcache will favor the stuff that hasn’t been hit in a long time, whereas in Redis, if I recall correctly, a read has no effect on the time to whatever or things like that. In my opinion, Memcached is still, by far, the better caching system. But Redis has other features that may get valuable, in my opinion.
其实就是 redis 当缓存用要手动刷新 expire 而已,客户端可以自动加 expire 指令不用操心的...
另外当 cache 也不能忽略其它功能啊,memcached 的功能太素了几乎啥都干不了
#23 楼 @coolesting #22 楼 @blacktulip do one thing 只是手段,do it well 才是目的啊 你可以对比下两者的代码量,可以发现 memcached 的代码其实不少,但很多都花在没用的事情上了... 例如兼容 windows. redis 才是专注搞功能和性能,对 windows 就直接告诉你用 cygwin 编译。
memcached 场景变复杂后,就要自己重造一些 redis 早就提供的功能挺郁闷的
#24 楼 @quakewang cool, 这样就全方面胜过 memcached 了
maxmemory-policy allkeys-lru
When Redis is used as a cache in this way, if the application also requires the use Redis as a store, it is strongly suggested to create two Redis instances, one as a cache, configured in this way, and one as a store, configured accordingly to your persistence needs and only holding keys that are not about cached data.
#29 楼 @coolesting 如果你只要 cache 字符串,而且规则很简单,就可以用 memcached, 但如果要 cache 其他数据结构如 list 或者 hash 或者 set, 用 memcached 就要自己多做很多工作还没 redis 快。