[#24] Client: Implement pool part1
first iteration - base classes and methods Signed-off-by: Pavel Gross <p.gross@yadro.com>
This commit is contained in:
parent
d1271df207
commit
c9a75ea025
72 changed files with 2786 additions and 468 deletions
29
src/FrostFS.SDK.ClientV2/Poll/SessionCache.cs
Normal file
29
src/FrostFS.SDK.ClientV2/Poll/SessionCache.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace FrostFS.SDK.ClientV2;
|
||||
|
||||
internal struct SessionCache
|
||||
{
|
||||
public SessionCache(ulong sessionExpirationDuration)
|
||||
{
|
||||
TokenDuration = sessionExpirationDuration;
|
||||
}
|
||||
|
||||
internal Hashtable Cache { get; } = [];
|
||||
|
||||
internal ulong CurrentEpoch { get; set; }
|
||||
|
||||
internal ulong TokenDuration { get; set; }
|
||||
|
||||
internal void DeleteByPrefix(string prefix)
|
||||
{
|
||||
foreach (var key in Cache.Keys)
|
||||
{
|
||||
if (((string)key).StartsWith(prefix, StringComparison.Ordinal))
|
||||
{
|
||||
Cache.Remove(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue