Commit 34e459ec authored by Alessio Parma's avatar Alessio Parma

uploaded file cache

parent b13d1968
Pipeline #148879888 passed with stages
in 35 minutes and 30 seconds
......@@ -169,10 +169,13 @@ public TempFileDTO(string contentType, string? extension)
ICache cache, IOptions<CacheConfiguration> cacheConfiguration,
TempFileDTO file, CancellationToken cancellationToken)
using var fileStream = File.OpenRead(file.Path);
var hash = ComputeHash(fileStream);
string hash;
using (var fileStream = File.OpenRead(file.Path))
hash = ComputeHash(fileStream);
var cachedFile = await cache.GetOrAddTimedAsync<TempFileDTO>(
var cachedFile = await cache.GetOrAddTimedAsync(
partition: nameof(TempFileDTO),
key: new CacheKey(hash),
valueGetter: () => Task.FromResult(file),
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment