couchbaselabs / Couchbase.Extensions

Extensions for Couchbase for .Net Core
Apache License 2.0
27 stars 14 forks source link

Upgrade caching to SDK 3.x #88

Closed brantburnett closed 4 years ago

brantburnett commented 4 years ago

Motivation

Provide support for distributed cache to users of the 3.x SDK.

Modifications

Upgrade to SDK 3.x. Rewrite Couchbase to be based on an ICouchbaseCollection instead of an IBucket. Also update to work with only async methods from ICouchbaseCollection, and to specifically force the use of the LegacyTranscoder for byte arrays.

Update the DI system to allow injecting a specific collection, but by default inject the default collection from the bucket specified. Also drop the overload that accepts a bucket password.

Upgrade to C# 8 and enable nullable reference types.

Update unit tests, the example project, and documentation.

Results

SDK 3.x compatibility, with future-proofing for scopes/collections.

The .GetAwaiter().GetResult() approach to async from sync is not perfect, as it could cause deadlocks depending on the SynchronizationContext in use. However, it's a decent and quick approach for now that may be improved in the future.

Closes #84

brantburnett commented 4 years ago

@jeffrymorris Changes made to the version and date