Update ImageFileCache.cs

This commit is contained in:
ClemensFischer 2024-02-05 13:11:33 +01:00
parent 547fa394e2
commit 595b106c6b

View file

@ -65,7 +65,12 @@ namespace MapControl.Caching
{
if (expiration.Value > DateTimeOffset.UtcNow)
{
memoryCache.Set(key, buffer, new DistributedCacheEntryOptions { AbsoluteExpiration = expiration });
var cacheOptions = new DistributedCacheEntryOptions
{
AbsoluteExpiration = expiration
};
memoryCache.Set(key, buffer, cacheOptions);
}
else
{
@ -104,7 +109,12 @@ namespace MapControl.Caching
{
if (expiration.Value > DateTimeOffset.UtcNow)
{
await memoryCache.SetAsync(key, buffer, new DistributedCacheEntryOptions { AbsoluteExpiration = expiration }, token).ConfigureAwait(false);
var cacheOptions = new DistributedCacheEntryOptions
{
AbsoluteExpiration = expiration
};
await memoryCache.SetAsync(key, buffer, cacheOptions, token).ConfigureAwait(false);
}
else
{