0
我向couchbase缓存添加一个值,过期时间为1秒,但过期时间超过20秒。 membase的缓存过期策略是什么?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;
}