fix: if cache get bytes then skip serealize

This commit is contained in:
2024-06-21 21:44:34 +03:00
parent 79151e7da8
commit 1a0d539e76
2 changed files with 5 additions and 4 deletions
Endpoint/Common/Services/Security

@ -17,7 +17,7 @@ public class DistributedCacheService(IDistributedCache cache) : ICacheService
SlidingExpiration = slidingExpiration
};
var serializedValue = JsonSerializer.SerializeToUtf8Bytes(value);
var serializedValue = value as byte[] ?? JsonSerializer.SerializeToUtf8Bytes(value);
await cache.SetAsync(key, serializedValue, options, cancellationToken);
}