protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); RedisProxyAgent.redisConfig = RedisConfig.GetConfig(); }
public RedisRepository() { var config = RedisConfig.GetConfig(); Context = new PooledRedisClientManager(config.WriteServerList.Split(',') , config.ReadServerList.Split(','), new RedisClientManagerConfig { DefaultDb = db, MaxReadPoolSize = config.MaxReadPoolSize, MaxWritePoolSize = config.MaxWritePoolSize, AutoStart = config.AutoStart }).GetClient(); }
/// <summary> /// 获取上下文 /// </summary> /// <returns></returns> public static PooledRedisClientManager Context(int db = 0) { var config = RedisConfig.GetConfig(); return(new PooledRedisClientManager(config.WriteServerList.Split(',') , config.ReadServerList.Split(','), new RedisClientManagerConfig { DefaultDb = db, MaxReadPoolSize = config.MaxReadPoolSize, MaxWritePoolSize = config.MaxWritePoolSize, AutoStart = config.AutoStart })); }
public ClusterMHelper(string configStr) { lock (locker) { if (File.Exists(_configPath)) { File.Delete(_configPath); } configStr = "<?xml version=\"1.0\" encoding=\"utf-8\"?><configuration> <configSections><section name=\"ClusterConfig\" type=\"Wenli.Drive.Redis.RedisConfig, Wenli.Drive.Redis\" /> </configSections>" + configStr; configStr += "</configuration>"; File.WriteAllText(_configPath, configStr, Encoding.UTF8); _helper.Init(RedisConfig.GetConfig(_configPath, "ClusterConfig")); } }
/// <summary> /// 资源文件初始化 /// </summary> /// <param name="dbFile"></param> public static void Init(string dbFile = "web.config", string projectName = null) { RedisConfig.GetConfig(projectName, dbFile); }
/// <summary> /// 初始化池,类似于构造方法 /// 不要重复调用 /// </summary> /// <param name="section"></param> /// <returns></returns> public void Init(string section) { Init(RedisConfig.GetConfig(section)); }