Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

interface Microsoft.​Extensions.​Caching.​Distributed.​IBufferDistributedCache

Assembly: Microsoft.Extensions.Caching.Abstractions

Implemented Interfaces

Represents a distributed cache of serialized values, with support for low allocation data transfer.

Methods

bool
TryGet​(string key, System.​Buffers.​IBufferWriter<​byte> destination)
Attempts to retrieve an existing cache item.
Returns <c>true</c> if the cache item is found, <c>false</c> otherwise.
key The unique key for the cache item.
destination The target to write the cache contents on success.
Remarks This method is functionally similar to <see cref="M:Microsoft.Extensions.Caching.Distributed.IDistributedCache.Get(System.String)" /> , but avoids the array allocation.
TryGetAsync​(string key, System.​Buffers.​IBufferWriter<​byte> destination, System.​Threading.​CancellationToken token = null)
Asynchronously attempts to retrieve an existing cache entry.
Returns <c>true</c> if the cache entry is found, <c>false</c> otherwise.
key The unique key for the cache entry.
destination The target to write the cache contents on success.
token The <see cref="T:System.Threading.CancellationToken" /> used to propagate notifications that the operation should be canceled.
Remarks This method is functionally similar to <see cref="M:Microsoft.Extensions.Caching.Distributed.IDistributedCache.GetAsync(System.String,System.Threading.CancellationToken)" /> , but avoids the array allocation.
void
Set​(string key, System.​Buffers.​ReadOnlySequence<​byte> value, DistributedCacheEntryOptions options)
Sets or overwrites a cache item.
key The key of the entry to create.
value The value for this cache entry.
options The cache options for the entry.
Remarks This method is functionally similar to <see cref="M:Microsoft.Extensions.Caching.Distributed.IDistributedCache.Set(System.String,System.Byte[],Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions)" /> , but avoids the array allocation.
SetAsync​(string key, System.​Buffers.​ReadOnlySequence<​byte> value, DistributedCacheEntryOptions options, System.​Threading.​CancellationToken token = null)
Asynchronously sets or overwrites a cache entry.
key The key of the entry to create.
value The value for this cache entry.
options The cache options for the value.
token The <see cref="T:System.Threading.CancellationToken" /> used to propagate notifications that the operation should be canceled.
Remarks This method is functionally similar to <see cref="M:Microsoft.Extensions.Caching.Distributed.IDistributedCache.SetAsync(System.String,System.Byte[],Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions,System.Threading.CancellationToken)" /> , but avoids the array allocation.