Files
WowUp/WowUp.WPF/Extensions/CacheExtensions.cs
jliddev 968abd6546 v1.3.0
add tukui/elvui support
2020-07-08 09:59:58 -05:00

22 lines
552 B
C#

using Microsoft.Extensions.Caching.Memory;
using System;
namespace WowUp.WPF.Extensions
{
public static class CacheExtensions
{
public static void CacheForAbsolute(this IMemoryCache cache, string cacheKey, object value, TimeSpan expiresIn)
{
if(cache == null)
{
return;
}
var cacheEntryOptions = new MemoryCacheEntryOptions()
.SetAbsoluteExpiration(expiresIn);
cache.Set(cacheKey, value, cacheEntryOptions);
}
}
}