using System.Collections.Concurrent; namespace FrostFS.SDK.Client; internal sealed class SessionCache(ulong sessionExpirationDuration) { private ConcurrentDictionary _cache { get; } = []; internal ulong CurrentEpoch { get; set; } internal ulong TokenDuration { get; set; } = sessionExpirationDuration; internal bool Contains(string key) { return _cache.ContainsKey(key); } internal bool TryGetValue(string? key, out FrostFsSessionToken? value) { if (key == null) { value = null; return false; } var ok = _cache.TryGetValue(key, out value); return ok && value != null; } internal void SetValue(string? key, FrostFsSessionToken value) { if (key != null) { _cache[key] = value; } } }