我向 couchbase 缓存添加了一个过期时间为 1 秒的值,但是它在超过 20 秒后过期。membase的缓存过期策略是什么?
这是我的代码
public string TestCache()
{
String spoon = null;
using (var client = new CouchbaseClient())
{
spoon=client.Get<string>("Spoon");
if(string.IsNullOrEmpty(spoon))
{
client.Store(StoreMode.Set,
"Spoon",
"Hello, Couchbase! Cache data is" + DateTime.Now.ToString(),
TimeSpan.FromSeconds(1));
}
spoon = client.Get<string>("Spoon");
}
return string.IsNullOrEmpty(spoon)
? "Can not get data from cache"
: "Data from cache: " + spoon;
}