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)); }
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)); }