What should the lifespan of IBucket be?

.net

#1

Hi Couchbase,

From previous conversations with ya’ll, it was recommended that a single instance of IBucket should be referenced and maintained for the lifetime of the application. My understanding was that it was relatively expensive to create/dispose instances since they establish a pool of socket connections to the cluster.

However, the documentation illustrates opening the bucket in a using statement.

https://docs.couchbase.com/dotnet-sdk/2.6/start-using-sdk.html

Can you please provide some input on this?


#2

@pkramer -

The documentation is just showing an example; in a real application it should be opened when the app starts and closed/disposed when the app shuts down. There is more depth on this subject in this page: https://docs.couchbase.com/dotnet-sdk/2.6/managing-connections.html

Thanks,
Jeff