internal DataCache(string cacheName, DataCacheFactoryConfiguration cacheConfiguration, bool expirable, TimeSpan defaultTTL) { if (string.IsNullOrWhiteSpace(cacheName)) { throw new ArgumentNullException(nameof(cacheName), "Value cannot be null"); } if (cacheConfiguration == null) { _cacheHandler = new CacheHandler(cacheName, null, expirable, defaultTTL); } else { CacheConnectionOptions connectionOptions = new CacheConnectionOptions { ConnectionTimeout = cacheConfiguration.ChannelOpenTimeout, ClientRequestTimeOut = cacheConfiguration.RequestTimeout }; if (cacheConfiguration.Servers != null && cacheConfiguration.Servers.Count() > 0) { var serverList = new List <ServerInfo>(cacheConfiguration.Servers.Count()); foreach (var server in cacheConfiguration.Servers) { serverList.Add(new ServerInfo(server.HostName, server.CachePort)); } connectionOptions.ServerList = serverList; } _cacheHandler = new CacheHandler(cacheName, connectionOptions, expirable, defaultTTL); } }
public DataCacheFactory(DataCacheFactoryConfiguration configuration) { _configuration = configuration.Clone() as DataCacheFactoryConfiguration; }