public static string SaveExpression(string key, dynamic value)
        {
            try
            {
                if (ExpressionCacheService == null || !ExpressionCacheService.IsConnectionActive())
                {
                    InitPropertyCacheConnection();
                }

                if (isExpressionCacheEnabled)
                {
                    var cacheKey   = HashUrl.GetHashAsString(key);
                    var cacheValue = JsonConvert.SerializeObject(value);

                    var task = ExpressionCacheService.Save(cacheKey, cacheValue, 60 * 12);
                    if (task.Wait(_cacheTimeout))
                    {
                        return($"{cacheKey}");
                    }
                    else
                    {
                        ConsoleLogger.Write($"ERROR: CACHE SaveExpression - Redis TimeOut");
                    }
                }
            }
            catch (Exception ex)
            {
                ConsoleLogger.Write($"ERROR: CACHE SaveExpression - {ex.ToString()}");
            }

            return(null);
        }
        public static List <BsonDocument> GetExpression(string key)
        {
            try
            {
                if (ExpressionCacheService == null || !ExpressionCacheService.IsConnectionActive())
                {
                    InitPropertyCacheConnection();
                }

                if (isExpressionCacheEnabled)
                {
                    var objectHashKey = HashUrl.GetHashAsString(key);

                    var task = ExpressionCacheService.Get(objectHashKey);
                    if (task.Wait(_cacheTimeout))
                    {
                        return(JsonConvert.DeserializeObject <List <BsonDocument> >(task.Result));
                    }
                    else
                    {
                        ConsoleLogger.Write($"ERROR: CACHE GetExpression - Redis TimeOut");
                    }
                }
            }
            catch (Exception ex)
            {
                ConsoleLogger.Write($"ERROR: CACHE GetExpression - {ex.ToString()}");
            }
            return(null);
        }
 private static void InitPropertyCacheConnection()
 {
     try
     {
         if (isExpressionCacheEnabled &&
             (ExpressionCacheService == null || !ExpressionCacheService.IsConnectionActive()))
         {
             ExpressionCacheService = new RedisCacheService(KLMExpressionCacheUrl, 6379);
         }
     }
     catch (Exception ex)
     {
         ConsoleLogger.Write($"ERROR: CACHE InitPropertyCacheConnection - {ex.ToString()}");
     }
 }