public static XDocument ReadXml(string path) { var lastWriteTimeUtc = FileSystemHelpers.GetLastWriteTimeUtc(path); if (!_fileContentCaches.TryGetValue(path, out FileContentCache cache) || cache.LastWriteTimeUtc < lastWriteTimeUtc) { cache = new FileContentCache(path, lastWriteTimeUtc, isXml: true); _fileContentCaches.AddOrUpdate(path, cache, (_, __) => cache); } return(cache.Xml); }
public static string ReadAllText(string path) { var lastWriteTimeUtc = FileSystemHelpers.GetLastWriteTimeUtc(path); if (!_fileContentCaches.TryGetValue(path, out FileContentCache cache) || cache.LastWriteTimeUtc < lastWriteTimeUtc) { cache = new FileContentCache(path, lastWriteTimeUtc); _fileContentCaches.AddOrUpdate(path, cache, (_, __) => cache); } return(cache.Content); }