/
githubmirror
/
Files
Обзор
Документация
Войти
/
githubmirror
/
Files
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Files.App/Services/Storage/StorageCacheService.cs
36 строк
930 B
yair100
Code Quality: Updated headers
01 июл 2026, 06:18
01 июл 2026, 06:18
c27305a
Код
Авторство
О чём код?
// Copyright (c) Files Community // SPDX-License-Identifier: MPL-2.0 using System.Collections.Concurrent; namespace Files.App.Utils.Storage { /// <inheritdoc cref="IStorageCacheService"/> internal sealed class StorageCacheService : IStorageCacheService { private readonly ConcurrentDictionary<string, string> cachedDictionary = new(); /// <inheritdoc/> public ValueTask<string> GetDisplayName(string path, CancellationToken cancellationToken) { return cachedDictionary.TryGetValue(path, out var displayName) ? ValueTask.FromResult(displayName) : ValueTask.FromResult(string.Empty); } /// <inheritdoc/> public ValueTask AddDisplayName(string path, string? displayName) { if (string.IsNullOrEmpty(displayName)) { cachedDictionary.TryRemove(path, out _); return ValueTask.CompletedTask; } cachedDictionary[path] = displayName; return ValueTask.CompletedTask; } } }