예제 #1
0
        public static IRegisterService RegisterCacheMemcached(this IRegisterService registerService,
                                                              Dictionary <string, int> memcachedConfig,
                                                              Func <Dictionary <string, int>, IBaseObjectCacheStrategy> memcachedObjectCacheStrategyInstance)
        {
            MemcachedObjectCacheStrategy.RegisterServerList(memcachedConfig);

            //此处先执行一次委托,直接在下方注册结果,提高每次调用的执行效率
            IBaseObjectCacheStrategy objectCacheStrategy = memcachedObjectCacheStrategyInstance(memcachedConfig);

            if (objectCacheStrategy != null)
            {
                CacheStrategyFactory.RegisterObjectCacheStrategy(() => objectCacheStrategy);//Memcached
            }

            return(registerService);
        }
예제 #2
0
 /// <summary>
 /// 设置连接信息(不立即启用)
 /// </summary>
 /// <param name="redisConfigurationString"></param>
 public static void SetConfigurationOption(string redisConfigurationString)
 {
     MemcachedObjectCacheStrategy.RegisterServerList(redisConfigurationString);
 }