<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="11.0.0-preview.3.26207.106" />

Microsoft.Extensions.Caching.Distributed.MemoryDistributedCache

public class MemoryDistributedCache : IDistributedCache
Implements IDistributedCache using IMemoryCache.
public MemoryDistributedCache(IOptions<MemoryDistributedCacheOptions> optionsAccessor)

Creates a new MemoryDistributedCache instance.

public MemoryDistributedCache(IOptions<MemoryDistributedCacheOptions> optionsAccessor, ILoggerFactory loggerFactory)

Creates a new MemoryDistributedCache instance.

public byte[] Get(string key)

Gets the specified item associated with a key from the IMemoryCache as a byte array.

public Task<byte[]> GetAsync(string key, CancellationToken token = default)

Asynchronously gets the specified item associated with a key from the IMemoryCache as a byte array.

public void Refresh(string key)

Refreshes the specified item associated with a key from the IMemoryCache.

public Task RefreshAsync(string key, CancellationToken token = default)

Asynchronously refreshes the specified item associated with a key from the IMemoryCache.

public void Remove(string key)

Removes the specified item associated with a key from the IMemoryCache.

public Task RemoveAsync(string key, CancellationToken token = default)

Asynchronously removes the specified item associated with a key from the IMemoryCache.

public void Set(string key, byte[] value, DistributedCacheEntryOptions options)

Sets the specified item associated with a key in the IMemoryCache as a byte array.

public Task SetAsync(string key, byte[] value, DistributedCacheEntryOptions options, CancellationToken token = default)

Asynchronously sets the specified item associated with a key in the IMemoryCache as a byte array.