Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-1605

Allow ICluster to be used with IoC

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Won't Fix
    • Major
    • backlog-2.0, .backlog
    • None
    • None
    • None

    Description

      Created on behalf of Community member Dirk Lemstra

      At this moment it is not possible to use an Cluster in an IoC container. When then Cluster is used inside an IoC Container the bucket should be created only once but at this moment it will be created multiple times. This can be avoided by caching the bucket but it would be nice if the Cluster would cache the bucket. The Cluster uses a ClusterController that caches buckets but when a bucket is disposed and no other threads are using the bucket the cached value will be invalidated. The next call to OpenBucketAsync will create and open a new bucket. This can be avoided by removing IDispose from the ICluster interface. This would mean that a call to Cluster.OpenBucketAsync would create a new bucket only once and the ClusterController will preserve the instance. And if a user would like to explicitly dispose the instance they could dispose the Cluster or call Cluster.DestroyBucket(IBucket) to remove the instance from the ClusterController cache and destroy the instance. Another good thing about removing the IDispose method from the ICluster interface is that ref counting can be removed. But the Cluster.OpenBucketAsync method should probably be renamed to Cluster.GetBucketAsync to avoid that users will think they would need to close it. 

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            Unassigned Unassigned
            mike.goldsmith Michael Goldsmith
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty