/// <summary> /// 删除缓存 /// </summary> public JsonResult delete(string keys) { string template = this.config.SitePath + "cache/"; if (!string.IsNullOrEmpty(keys)) { string[] _keys = keys.Split(';'); foreach (string _key in _keys) { if (!string.IsNullOrEmpty(_key)) { string[] cacheKey = _key.Split(':'); if (cacheKey.Length == 2) { try { var key = Utils.replace(cacheKey[0], "__", "/"); switch (cacheKey[1]) { case "0": //删除文件夹 Directory.Delete(Fetch.getMapPath(template + key + "/"), true); break; case "1": //删除文件 System.IO.File.Delete(Fetch.getMapPath(template + key)); break; case "2": //删除缓存 TemplateCache.deleteCache(key); break; } } catch (Exception) { } } } } } else { TemplateCache.clearCache();//清除所有 } return(this.getResult(Entity.Error.请求成功, "删除成功")); }