コード例 #1
0
ファイル: FileSystemCache.cs プロジェクト: Rhayar-dr/kudu-1
        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);
        }
コード例 #2
0
ファイル: FileSystemCache.cs プロジェクト: Rhayar-dr/kudu-1
        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);
        }