默认缓冲时间可以配置

This commit is contained in:
falcon 2019-03-28 10:26:25 +08:00
parent 1226314d87
commit aaf152055d
2 changed files with 16 additions and 1 deletions

View File

@ -76,7 +76,7 @@ namespace Cmdjy.Bll
}
public virtual void SetData<T>(string key,T obj) {
SetData(key,obj,new TimeSpan(3,0,0,0));
SetData(key,obj,WebSettings.DefaultCacheTimeSpan);
}
public virtual void SetData<T>(string key,T obj,TimeSpan timeSpan) {

View File

@ -51,5 +51,20 @@ namespace Cmdjy
return true;
}
}
/// <summary>
/// 已秒为单位的默认缓冲时间。
/// </summary>
public static TimeSpan DefaultCacheTimeSpan {
get {
var v = GetValue("DefaultCacheTimeSpan");
if(v == null || !long.TryParse(v,out var lv)) {
return new TimeSpan(0,10,0);
}
else {
return new TimeSpan(lv * 1000000 / 100);
}
}
}
}
}