Exemple #1
0
        public CachedAccount(string name, IDictionary <string, string> options, ICachableAccount account)
            : base(name, options)
        {
            Account = account;

            int cache_positive_time = 600;

            if (options.ContainsKey("cache_positive_time"))
            {
                cache_positive_time = int.Parse(options["cache_positive_time"]);
            }

            int cache_negative_time = 60;

            if (options.ContainsKey("cache_negative_time"))
            {
                cache_negative_time = int.Parse(options["cache_negative_time"]);
            }

            int cache_positive_max_size = 10000;

            if (options.ContainsKey("cache_positive_max_size"))
            {
                cache_positive_time = int.Parse(options["cache_positive_max_size"]);
            }

            int cache_negative_max_size = 1000;

            if (options.ContainsKey("cache_negative_max_size"))
            {
                cache_negative_time = int.Parse(options["cache_negative_max_size"]);
            }

            cache_positive = null;
            cache_negative = null;
            if (cache_positive_time > 0)
            {
                cache_positive = new ExpirableCache(cache_positive_time, cache_positive_max_size);
            }
            if (cache_negative_time > 0)
            {
                cache_negative = new ExpirableCache(cache_negative_time, cache_negative_max_size);
            }

            //cache = new MemoryCache("CachedAccount[" + name + "]");
            //cache = new Dictionary<string, Tuple<AccountStatus, DateTime, TimeSpan, int>>();
        }
Exemple #2
0
        public CachedAccount(string name, IDictionary<string, string> options, ICachableAccount account)
            : base(name, options)
        {
            Account = account;

            int cache_positive_time = 600;
            if (options.ContainsKey("cache_positive_time"))
            {
                cache_positive_time = int.Parse(options["cache_positive_time"]);
            }

            int cache_negative_time = 60;
            if (options.ContainsKey("cache_negative_time"))
            {
                cache_negative_time = int.Parse(options["cache_negative_time"]);
            }

            int cache_positive_max_size = 10000;
            if (options.ContainsKey("cache_positive_max_size"))
            {
                cache_positive_time = int.Parse(options["cache_positive_max_size"]);
            }

            int cache_negative_max_size = 1000;
            if (options.ContainsKey("cache_negative_max_size"))
            {
                cache_negative_time = int.Parse(options["cache_negative_max_size"]);
            }

            cache_positive = null;
            cache_negative = null;
            if (cache_positive_time > 0)
            {
                cache_positive = new ExpirableCache(cache_positive_time, cache_positive_max_size);
            }
            if (cache_negative_time > 0)
            {
                cache_negative = new ExpirableCache(cache_negative_time, cache_negative_max_size);
            }

            //cache = new MemoryCache("CachedAccount[" + name + "]");
            //cache = new Dictionary<string, Tuple<AccountStatus, DateTime, TimeSpan, int>>();
        }