diff options
author | Sergey Chebotar <s.chebotar@gmail.com> | 2021-12-24 16:22:03 +0300 |
---|---|---|
committer | Sergey Chebotar <s.chebotar@gmail.com> | 2021-12-24 16:22:03 +0300 |
commit | 24024b5729c1c44bb01cb29813868743d1753e31 (patch) | |
tree | 673a1c1102e04adee36be8ded4934d2e40794fef /Source/Assistant | |
parent | 2a4076d6eef1b4556f6af8cb074638d440927c5e (diff) |
MergeTool, MemoryUtil anf stuff
Diffstat (limited to 'Source/Assistant')
-rw-r--r-- | Source/Assistant/MemoryCacheExtensions.cs | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/Source/Assistant/MemoryCacheExtensions.cs b/Source/Assistant/MemoryCacheExtensions.cs deleted file mode 100644 index 7eb1408..0000000 --- a/Source/Assistant/MemoryCacheExtensions.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Runtime.Caching; -using System.Threading.Tasks; - -namespace RehauSku.Assistant -{ - static class MemoryCacheExtensions - { - public static bool IsCached(this string request) - { - return MemoryCache.Default.Contains(request); - } - - public static IProduct GetFromCache(this string request) - { - return MemoryCache.Default[request] as IProduct; - } - - public static async Task<IProduct> RequestAndCache(this string request) - { - IProduct product = await SkuAssist.GetProductAsync(request); - - if (product == null) - return null; - - MemoryCache.Default.Add(request, product, DateTime.Now.AddMinutes(10)); - return product; - } - } -}
\ No newline at end of file |