diff --git a/WebSiteCode/Cmdjy/Cmdjy/Bll/Cache.cs b/WebSiteCode/Cmdjy/Cmdjy/Bll/Cache.cs index b77b64e..a8ddbdc 100644 --- a/WebSiteCode/Cmdjy/Cmdjy/Bll/Cache.cs +++ b/WebSiteCode/Cmdjy/Cmdjy/Bll/Cache.cs @@ -16,7 +16,7 @@ namespace Cmdjy.Bll /// 数据类型 /// 保存的key /// 缓存的数据 - T GetData(string key); + T GetData(string key) where T : class; /// /// 缓存数据,缓存时间默认 /// @@ -55,8 +55,8 @@ namespace Cmdjy.Bll this.Database = this.Database ?? Connection.GetDatabase(0); } - public T GetData(string key) { - if(!Usable) return default(T); + public T GetData(string key) where T : class { + if(!Usable) return null; return fromJson(Database.StringGet(key)); }