public Stores(Setting setting) { this.setting = setting; stores = new Dictionary<string, Store.IStore>(setting.Config.Stores.Count); for (int i = 0; i < setting.Config.Stores.Count; i++) { Config.Store configStore = setting.Config.Stores[i]; Store.IStore store = Store.Factory.CreateInstance(configStore); stores.Add(configStore.Name, store); } }
public Rule(Rules rules, Config.Rule configRule) { this.rules = rules; this.setting = rules.Setting; this.configRule = configRule; this.createFirst = configRule.CreateFirst; matchRegex = new Regex(configRule.Match, configRule.IgnoreCase ? RegexOptions.IgnoreCase : RegexOptions.None); if (configRule.Skip != null) { skipRegex = new Regex(configRule.Skip, configRule.IgnoreCase ? RegexOptions.IgnoreCase : RegexOptions.None); } }
/// <summary> /// 初始化 /// </summary> /// <param name="setting"></param> /// <param name="module"></param> public CacheService(Setting.Setting setting, CacheModule module) { this.setting = setting; this.module = module; config = setting.Config; //this.memoryDataList = new Store.MemoryDataList(config.MemoryRule.Capacity, config.MemoryRule.ClearSeconds, config.MemoryRule.RemoveSeconds); this.lastReadDataList = new Store.LastReadDataList(config.CCLevel, config.LastReadBufferSize); this.storeDataList = new Store.StoreDataList(config.CCLevel, config.StoreBufferSize); //this.creatingKeyList = new List<string>(); //this.requestQueue = new RequestQueue(); this.httpClient = new Common.HttpClient(); this.httpClient.ReceiveTimeout = config.NetReceiveTimeout; this.httpClient.SendTimeout = config.NetSendTimeout; if (!string.IsNullOrEmpty(config.ErrorLogPath)) { this.errorLog = new Common.Log(config.ErrorLogPath); this.httpClient.ErrorLog = this.errorLog; } if (!string.IsNullOrEmpty(config.AccessLogPath)) { this.accessLog = new Common.Log(config.AccessLogPath); } }
public Hosts(Setting setting) { this.setting = setting; int c = setting.Config.Hosts.Count; hosts = new Dictionary<string, Host>(c); for (int i = 0; i < c; i++) { var host = setting.Config.Hosts[i]; hosts.Add(host.Name, new Host(this, host)); } }
public Setting.Setting GetCacheSetting() { string cache_key = CACHE_KEY + "_Setting"; Setting.Setting setting = null; var cache = HttpRuntime.Cache; object cacheObject = cache.Get(cache_key); if (cacheObject != null) { setting = cacheObject as Setting.Setting; } else { var config = GetCacheConfig(); if (config != null) { setting = new Setting.Setting(config); if (setting != null) { this.scriptTimeout = Convert.ToInt32(Math.Ceiling((decimal)(setting.Config.NetReceiveTimeout + setting.Config.NetSendTimeout) / (decimal)1000)); if (this.scriptTimeout <= 0) { this.scriptTimeout = 10; } cache.Insert(cache_key, setting); } } } return setting; }
public Rules(Setting setting) { this.setting = setting; int c = setting.Config.Rules.Count; rules = new List<Rule>(c); for (int i = 0; i < c; i++) { rules.Add(new Rule(this, setting.Config.Rules[i])); } }