/// <summary> /// Function to initialize the provider /// </summary> /// <param name="name">Name of the element in the configuration file</param> /// <param name="config">Configuration values for the provider from the Web.config file</param> public override void Initialize( string name, NameValueCollection config) { // Initialize the base class base.Initialize(name, config); // Create our Couchbase bucket instance _bucket = ProviderHelper.GetBucket(name, config); // By default use exclusive session access. But allow it to be overridden in the config file var exclusive = ProviderHelper.GetAndRemove(config, "exclusiveAccess", false) ?? "true"; _exclusiveAccess = (string.Compare(exclusive, "true", StringComparison.OrdinalIgnoreCase) == 0); // Allow optional header and data prefixes to be used for this application var headerPrefix = ProviderHelper.GetAndRemove(config, "headerPrefix", false); if (headerPrefix != null) { _headerPrefix = headerPrefix; } var dataPrefix = ProviderHelper.GetAndRemove(config, "dataPrefix", false); if (dataPrefix != null) { _dataPrefix = dataPrefix; } // Make sure no extra attributes are included ProviderHelper.CheckForUnknownAttributes(config); }
public void GetBucket_CouchbaseCache_ReturnsMemcachedBucket() { var config = new NameValueCollection { { "bucket", "default" } }; var cluster = ProviderHelper.GetCluster("couchbase-cache", null); var bucket = ProviderHelper.GetBucket("default", config, cluster); Assert.AreEqual(typeof(CouchbaseBucket), bucket.GetType()); }
public void GetBucket_CouchbaseCache_ReturnsBucket() { var config = new NameValueCollection { { "bucket", "default" } }; var cluster = ProviderHelper.GetCluster("couchbase-cache", null); var bucket = ProviderHelper.GetBucket("default", config, cluster); Assert.IsNotNull(bucket); }
/// <summary> /// Function to initialize the provider /// </summary> /// <param name="name">Name of the element in the configuration file</param> /// <param name="config">Configuration values for the provider from the Web.config file</param> public override void Initialize(string name, NameValueCollection config) { // Initialize the base class base.Initialize(name, config); lock (_syncObj) { if (_cluster == null) { // Create our Cluster based off the CouchbaseConfigSection _cluster = ProviderHelper.GetCluster(name, config); } if (_bucket == null) { // Create the bucket based off the name provided in the _bucket = ProviderHelper.GetBucket(name, config, _cluster); } else { ProviderHelper.GetAndRemove(config, "bucket", false); } } // By default use exclusive session access. But allow it to be overridden in the config file var exclusive = ProviderHelper.GetAndRemove(config, "exclusiveAccess", false) ?? "true"; _exclusiveAccess = (string.Compare(exclusive, "true", StringComparison.OrdinalIgnoreCase) == 0); // Allow optional header and data prefixes to be used for this application var headerPrefix = ProviderHelper.GetAndRemove(config, "headerPrefix", false); if (headerPrefix != null) { HeaderPrefix = headerPrefix; } var dataPrefix = ProviderHelper.GetAndRemove(config, "dataPrefix", false); if (dataPrefix != null) { DataPrefix = dataPrefix; } var maxRetryCount = ProviderHelper.GetAndRemove(config, "maxRetryCount", false); var temp = 0; if (int.TryParse(maxRetryCount, out temp)) { _maxRetryCount = temp; } // Make sure no extra attributes are included ProviderHelper.CheckForUnknownAttributes(config); }
/// <summary> /// Function to initialize the provider /// </summary> /// <param name="name">Name of the element in the configuration file</param> /// <param name="config">Configuration values for the provider from the Web.config file</param> public override void Initialize( string name, NameValueCollection config) { // Initialize the base class base.Initialize(name, config); // Create our Couchbase bucket instance _bucket = ProviderHelper.GetBucket(name, config); // Allow optional prefix to be used for this application var prefix = ProviderHelper.GetAndRemove(config, "prefix", false); if (prefix != null) { _prefix = prefix; } // Make sure no extra attributes are included ProviderHelper.CheckForUnknownAttributes(config); }