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;
}