aboutsummaryrefslogtreecommitdiff
path: root/Source/Assistant/MemoryCacheExtensions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Assistant/MemoryCacheExtensions.cs')
-rw-r--r--Source/Assistant/MemoryCacheExtensions.cs30
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