` protected T ReadFromCache<T>(string key, Func<T> setFunc, int? timeout = null)
{
if (Cache.TryGetValue(key, out T rv) == false)
{
T data = setFunc();
if (timeout == null)
{
Cache.Add(key, data);
}
else
{
Cache.Add(key, data, new DistributedCacheEntryOptions()
{
SlidingExpiration = new TimeSpan(timeout.Value)
});
}
return data;
}
else
{
return rv;
}
}`
SlidingExpiration = new TimeSpan(timeout.Value)
这里的默认时间单位是千万分一秒,单位量也太小了,而且 timeout是int类型的,能不能把 ReadFromCache 这个默认的时间改成 秒?