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.