[#23] Client: Refactoring to optimize memory usage
Signed-off-by: Pavel Gross <p.gross@yando.com>
This commit is contained in:
parent
1a02ac2ae7
commit
6562aa27a5
141 changed files with 1722 additions and 896 deletions
|
@ -1,9 +1,11 @@
|
|||
using System;
|
||||
|
||||
using FrostFS.Refs;
|
||||
using FrostFS.SDK.Cryptography;
|
||||
using FrostFS.SDK.ModelsV2;
|
||||
|
||||
using Google.Protobuf;
|
||||
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using System;
|
||||
|
||||
namespace FrostFS.SDK.ClientV2.Mappers.GRPC;
|
||||
|
||||
|
@ -13,7 +15,7 @@ public static class OwnerIdMapper
|
|||
.SetSlidingExpiration(TimeSpan.FromHours(1))
|
||||
.SetSize(1);
|
||||
|
||||
public static OwnerID ToMessage(this OwnerId model)
|
||||
public static OwnerID ToMessage(this FrostFsOwner model)
|
||||
{
|
||||
if (!Cache.Owners.TryGetValue(model, out OwnerID? message))
|
||||
{
|
||||
|
@ -28,11 +30,11 @@ public static class OwnerIdMapper
|
|||
return message!;
|
||||
}
|
||||
|
||||
public static OwnerId ToModel(this OwnerID message)
|
||||
public static FrostFsOwner ToModel(this OwnerID message)
|
||||
{
|
||||
if (!Cache.Owners.TryGetValue(message, out OwnerId? model))
|
||||
if (!Cache.Owners.TryGetValue(message, out FrostFsOwner? model))
|
||||
{
|
||||
model = new OwnerId(Base58.Encode(message.Value.ToByteArray()));
|
||||
model = new FrostFsOwner(Base58.Encode(message.Value.ToByteArray()));
|
||||
|
||||
Cache.Owners.Set(message, model, _oneHourExpiration);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue