コード例 #1
0
        public void SetUp()
        {
            var bucket = ConfigUtil.ServerConfig.Buckets.Find(x => x.BucketType == "memcached");
            _servers = bucket.Nodes.
                Select(node => new Server(ObjectFactory.CreateIOStrategy(node), node, new ClientConfiguration())).
                Cast<IServer>().
                ToList();

            _keyMapper = new KetamaKeyMapper(_servers);
        }
コード例 #2
0
        public void SetUp()
        {
            var json = File.ReadAllText(@"Data\\Configuration\\cb4-config-4-nodes.json");
            var bucketConfig = JsonConvert.DeserializeObject<BucketConfig>(json);

            _servers = new Dictionary<IPAddress, IServer>();
            foreach (var node in bucketConfig.GetNodes())
            {
                _servers.Add(node.GetIPAddress(),
                    new Server(new FakeIOService(node.GetIPEndPoint(), new FakeConnectionPool(), false),
                       node,
                       new ClientConfiguration(), bucketConfig,
                       new FakeTranscoder()));
            }

            _keyMapper = new KetamaKeyMapper(_servers);
        }