From dca3481e9a91e1c9d5b86e1508b0a2993088e759 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Mon, 4 Jul 2022 11:33:29 +0300 Subject: Remove Store Functions --- src/AddIn/MemoryCacheUtil.cs | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 src/AddIn/MemoryCacheUtil.cs (limited to 'src/AddIn/MemoryCacheUtil.cs') diff --git a/src/AddIn/MemoryCacheUtil.cs b/src/AddIn/MemoryCacheUtil.cs deleted file mode 100644 index 1d42e14..0000000 --- a/src/AddIn/MemoryCacheUtil.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Runtime.Caching; -using System.Threading.Tasks; -using RehauSku.Assistant; - -namespace RehauSku -{ - static class MemoryCacheUtil - { - public static bool IsCached(this string request) - { - return AddIn.memoryCache.Contains(request); - } - - public static IProduct GetFromCache(this string request) - { - return AddIn.memoryCache[request] as IProduct; - } - - public static async Task RequestAndCache(this string request) - { - IProduct product = await SkuAssist.GetProductAsync(request); - - if (product == null) - return null; - - AddIn.memoryCache.Add(request, product, DateTime.Now.AddMinutes(10)); - return product; - } - - public static void ClearCache() - { - AddIn.memoryCache.Dispose(); - AddIn.memoryCache = new MemoryCache("RehauSku"); - } - } -} \ No newline at end of file -- cgit v1.2.3