Can I Use No Dispose Mode

The example using
using (var bucket = cluster.OpenBucket())
{
bucket.Upsert(“somekey”, “somevalue”);
}
But I Use bucket as static
so only
bucket.Upsert(“somekey”, “somevalue”);
on production environment
Is’s right
thanks you

@edobnet

Yes, that is correct. You should only keep a singleton instance of the Cluster and Bucket objects in production. You can also use the ClusterHelper class to assist with this. It’s designed to help control the singleton instances for you, just call ClusterHelper.GetBucket() whenever you need a bucket.

Brant

1 Like