Class CouchbaseConfigurationManager
Manages configurations for the couchbase cache handle.
As of version 1.0.2, changed the management of Couchbase.Core.IBuckets as those instances are already managed by the Couchbase.Core.IClusterController of the couchbase client libraray. No need to have additional collections of stuff in here.
We keep track of added configurations via WithCouchbaseConfiguration(ConfigurationBuilderCachePart, String, ClientConfiguration) and eventually added predefined Couchbase.Core.ICluster. Referencing still works via configuration key, although, if nothing in particular is defined, the fallback should always at least go to the couchbase default cluster settings.
Also new, fallback to Couchbase.ClusterHelper which can be used to initialize settings of a cluster statically.
Inherited Members
Namespace:CacheManager.Couchbase
Assembly:CacheManager.Couchbase.dll
Syntax
public class CouchbaseConfigurationManager
Constructors
| Improve this Doc View SourceCouchbaseConfigurationManager(String, String, String)
Initializes a new instance of the CouchbaseConfigurationManager class.
Declaration
public CouchbaseConfigurationManager(string configurationKey, string bucketName = "default", string bucketPassword = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | configurationKey | The configuration name. |
| String | bucketName | The bucket name. |
| String | bucketPassword | The bucket password. |
Fields
| Improve this Doc View SourceDefaultBucketName
The default bucket name
Declaration
public const string DefaultBucketName = "default"
Field Value
| Type | Description |
|---|---|
| String |
DefaultCouchbaseConfigurationSection
The section name usually used for couchbase in app/web.config.
Declaration
public const string DefaultCouchbaseConfigurationSection = "couchbaseClients/couchbase"
Field Value
| Type | Description |
|---|---|
| String |
Properties
| Improve this Doc View SourceBucket
Gets a bucket for configuration name and bucket name.
Declaration
public IBucket Bucket { get; }
Property Value
| Type | Description |
|---|---|
| Couchbase.Core.IBucket | The bucket. |
Methods
| Improve this Doc View SourceAddCluster(String, ICluster)
Adds a already configured Couchbase.Core.IBucket to the named collection of buckets. This can be referenced by the BucketCacheHandle<TCacheValue> via configuration key and Couchbase.Core.IBucket.Name.
Declaration
public static void AddCluster(string configurationKey, ICluster cluster)
Parameters
| Type | Name | Description |
|---|---|---|
| String | configurationKey | The configuration key. |
| Couchbase.Core.ICluster | cluster | The bucket. |
AddConfiguration(String, ClientConfiguration)
Adds a Couchbase.Configuration.Client.ClientConfiguration for a configurationKey.
Declaration
public static void AddConfiguration(string configurationKey, ClientConfiguration configuration)
Parameters
| Type | Name | Description |
|---|---|---|
| String | configurationKey | The name. |
| Couchbase.Configuration.Client.ClientConfiguration | configuration | The configuration. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | If name or configuration are null. |
GetConfiguration(String)
Gets a Couchbase.Configuration.Client.ClientConfiguration for the given configurationKeyOrSectionName.
If the configuration is not already present and the target framework supports ConfigurationManager, the method tries to resolve the configuration from the
section with the given name.
Declaration
public static ClientConfiguration GetConfiguration(string configurationKeyOrSectionName)
Parameters
| Type | Name | Description |
|---|---|---|
| String | configurationKeyOrSectionName | The name. |
Returns
| Type | Description |
|---|---|
| Couchbase.Configuration.Client.ClientConfiguration | The configuration. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | If name is null. |
| InvalidOperationException | If no configuration or section can be found for configuration. |
GetManager()
Gets a Couchbase.Management.IBucketManager instance. If username and password have been defined in the bucket's configuration, those will be used to create the manager.
Declaration
public IBucketManager GetManager()
Returns
| Type | Description |
|---|---|
| Couchbase.Management.IBucketManager | The manager instance or null. |