Ejemplo n.º 1
0
        public static IMemcachedClient GetClient(string name, NameValueCollection config, Func <IMemcachedClientFactory> createDefault)
        {
            var factory = GetFactoryInstance(ProviderHelper.GetAndRemove(config, "factory", false), createDefault);

            System.Diagnostics.Debug.Assert(factory != null, "factory == null");

            return(factory.Create(name, config));
        }
Ejemplo n.º 2
0
        IMemcachedClient IMemcachedClientFactory.Create(string name, NameValueCollection config)
        {
            var sectionName = ProviderHelper.GetAndRemove(config, "section", false);

            if (String.IsNullOrEmpty(sectionName))
            {
                return(new Membase.MembaseClient());
            }

            var section = ConfigurationManager.GetSection(sectionName) as IMembaseClientConfiguration;

            if (section == null)
            {
                throw new InvalidOperationException("Invalid config section: " + section);
            }

            return(new Membase.MembaseClient(section));
        }
        IMemcachedClient IMemcachedClientFactory.Create(string name, NameValueCollection config)
        {
            var section = ProviderHelper.GetAndRemove(config, "section", false);

            return(String.IsNullOrEmpty(section) ? new MemcachedClient() : new MemcachedClient(section));
        }