Esempio n. 1
0
 public static double CalculateP(BitArray value, int k, DerivativeCache <double> cache = null)
 {
     if (null == cache)
     {
         return(BinaryDerivativeDelegate(value, k));
     }
     else
     {
         return(cache.GetOrCreate(new MultiKey(value, k), BinaryDerivativeDelegate).GetAwaiter().GetResult());
     }
 }
Esempio n. 2
0
        public static void EnableCache()
        {
            _cacheEnabled = true;
            if (!int.TryParse(ConfigurationManager.AppSettings["slidingExpirationSecond"], out var slidingExpiration))
            {
                slidingExpiration = 600;
            }

            if (!int.TryParse(ConfigurationManager.AppSettings["absoluteExpirationSeconds"], out var absoluteExpiration))
            {
                absoluteExpiration = 3600;
            }

            _cache = new DerivativeCache <double>(slidingExpiration, absoluteExpiration);
        }
Esempio n. 3
0
 public static void DisableCache()
 {
     _cacheEnabled = false;
     _cache        = null;
 }