Example #1
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     RedisProxyAgent.redisConfig = RedisConfig.GetConfig();
 }
Example #2
0
        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();
        }
Example #3
0
        /// <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
            }));
        }
Example #4
0
 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"));
     }
 }
Example #5
0
 /// <summary>
 /// 资源文件初始化
 /// </summary>
 /// <param name="dbFile"></param>
 public static void Init(string dbFile = "web.config", string projectName = null)
 {
     RedisConfig.GetConfig(projectName, dbFile);
 }
Example #6
0
 /// <summary>
 ///     初始化池,类似于构造方法
 ///     不要重复调用
 /// </summary>
 /// <param name="section"></param>
 /// <returns></returns>
 public void Init(string section)
 {
     Init(RedisConfig.GetConfig(section));
 }