在.NET-Core
项目中使用了Memcached
用来缓存,在windows 也安装了相应的客户端。
用CMD
使用 telnet localhost 11211
进入Memcached
进行操作。
问题是这样的,
我使用 stats items
列出了所有了所有的key
值
然后使用 stats cachedump key 1000
来列出这个缓存的Key
值
如下图所示
这些都没问题,问题出在我用 get key
来获取值的时候,这个值就消失了,请问这是什么原因?
Memcached 中缓存清除的机制:
Expiration in memcached is lazy. In general, an item cannot be known to be expired until something looks at it.
If you fetch an expired item, memcached will find the item, notice that it's expired, and free its memory. This gives you the common case of normal cache churn reusing its own memory.