缓存依赖
文件依赖,文件改变,缓存清除
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | XmlDocument xmlDoc = new XmlDocument(); public XmlHelper() { string xmlPath = HttpRuntime.AppDomainAppPath + "\\Config.xml" ; //xmlDoc.Load(xmlPath); xmlDoc=GetXmlDocument(xmlPath); } public static XmlDocument GetXmlDocument( string xmlPath) { XmlDocument doc = new XmlDocument(); string key = "config.xml" ; Object obj = DataCache.GetCache(key); if (obj == null ) { doc.Load(xmlPath); DataCache.SetCache(key, doc, new CacheDependency(xmlPath)); } else { doc = (XmlDocument)obj; } return doc; } |
生活没有输赢,不要在乎别人如何评价你,开心就好。
QQ群:158138959
【推荐】100%开源!大型工业跨平台软件C++源码提供,建模,组态!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】Flutter适配HarmonyOS 5知识地图,实战解析+高频避坑指南
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步