private CacheReturnModel RetrieveCacheEntry(InvocationContext invocationContext, string key)
 {
     var cacheReturnObj = new CacheReturnModel();
     try
     {
         var returnType = invocationContext.GetMethodReturnType();
         cacheReturnObj.CacheEntry = IsReturnTypeGenericCollection(returnType) ?
             RetrieveCollectionFromCache(key, returnType) :
             _memoryCacheService.Get(key);
     }
     catch (Exception ex)
     {
         cacheReturnObj.CacheContext = CreateCacheExceptionInfoMessage(key, ex);
     }
     return cacheReturnObj;
 }
 private void StoreInCache(object result, InvocationContext invocationContext)
 {
     if (result != null &&
         (!IsReturnTypeGenericCollection(result.GetType()) || ((IList)result).Count > 0))
     {
         var cacheResturnobj = new CacheReturnModel();
         cacheResturnobj.CacheEntry = result;
         try
         {
             var obj = (ICacheable)result;
             _memoryCacheService.Put(CacheKey, obj);
         }
         catch (Exception ex)
         {
             invocationContext.TempData = CreateCacheExceptionInfoMessage(CacheKey, ex);
         }
     }
 }