public static DataSet GetCacheXML(string fileName, string keyName) { string key = "GetCacheXml_" + keyName; DataSet ds = CacheHlper.Get(key) as DataSet; if (ds != null && ds.Tables.Count > 0) { return(ds); } ds = new DataSet(); ds.ReadXml(fileName); CacheHlper.Add(key, ds); return(ds); }
/// <summary> /// 缓存本地txt文件 /// </summary> /// <param name="keyName"></param> /// <param name="url"></param> /// <returns></returns> public static string GetCacheStrByTxt(string keyName, string fileName) { string chcheKey = "GetCacheStr_" + keyName; string result = CacheHlper.Get(chcheKey) as String; if (!string.IsNullOrEmpty(result)) { return(result); } string content = Gecko.Common.FileHelper.ReadTextFileString(fileName); CacheHlper.Add(chcheKey, content); return(content); }