memcached expiration time

前端 未结 8 1982
面向向阳花
面向向阳花 2020-12-29 08:46

Memcached provides a cache expiration time option, which specifies how long objects are retained in the cache. Assuming all writes are through the cache I f

8条回答
  •  佛祖请我去吃肉
    2020-12-29 09:32

    I was curious about this myself, when I first started working with memcached. We asked friends who worked at hi5 and facebook (both heavy users of memcached).

    They both said that they generally use something like a 3 hour default expire time as sort of a "just in case".

    1. For most objects, it's not that expensive to rebuild them every 3 hours
    2. On the off chance you've got some bug that causes things to stay cached that shouldn't otherwise, this can keep you from getting into too much trouble

    So I guess the answer to the question "Why?" is really, "Why not?". It doesn't cost you much to have an expiration in there, and it will probably only help ensure you're not keeping stale data in the cache.

提交回复
热议问题