Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

RedisCache Class

Definition

Namespace:
Microsoft.Extensions.Caching.StackExchangeRedis
Assembly:
Microsoft.Extensions.Caching.StackExchangeRedis.dll
Package:
Microsoft.Extensions.Caching.StackExchangeRedis v11.0.0-preview.5.26302.115
Source:
RedisCache.cs
Source:
RedisCache.cs
Source:
RedisCache.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Distributed cache implementation using Redis.

Uses StackExchange.Redis as the Redis client.

public ref class RedisCache : IDisposable, Microsoft::Extensions::Caching::Distributed::IBufferDistributedCache
public class RedisCache : IDisposable, Microsoft.Extensions.Caching.Distributed.IBufferDistributedCache
type RedisCache = class
 interface IBufferDistributedCache
 interface IDistributedCache
 interface IDisposable
Public Class RedisCache
Implements IBufferDistributedCache, IDisposable
Inheritance
RedisCache
Implements

Constructors

Name Description
RedisCache(IOptions<RedisCacheOptions>)

Initializes a new instance of RedisCache.

Methods

Name Description
Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Get(String)

Gets a value with the given key.

GetAsync(String, CancellationToken)

Gets a value with the given key.

Refresh(String)

Refreshes a value in the cache based on its key, resetting its sliding expiration timeout (if any).

RefreshAsync(String, CancellationToken)

Refreshes a value in the cache based on its key, resetting its sliding expiration timeout (if any).

Remove(String)

Removes the value with the given key.

RemoveAsync(String, CancellationToken)

Removes the value with the given key.

Set(String, Byte[], DistributedCacheEntryOptions)

Sets a value with the given key.

SetAsync(String, Byte[], DistributedCacheEntryOptions, CancellationToken)

Sets the value with the given key.

Explicit Interface Implementations

Name Description
IBufferDistributedCache.Set(String, ReadOnlySequence<Byte>, DistributedCacheEntryOptions)
IBufferDistributedCache.SetAsync(String, ReadOnlySequence<Byte>, DistributedCacheEntryOptions, CancellationToken)
IBufferDistributedCache.TryGet(String, IBufferWriter<Byte>)
IBufferDistributedCache.TryGetAsync(String, IBufferWriter<Byte>, CancellationToken)

Extension Methods

Name Description
GetString(IDistributedCache, String)

Gets a string from the specified cache with the specified key.

GetStringAsync(IDistributedCache, String, CancellationToken)

Asynchronously gets a string from the specified cache with the specified key.

Set(IDistributedCache, String, Byte[])

Sets a sequence of bytes in the specified cache with the specified key.

SetAsync(IDistributedCache, String, Byte[], CancellationToken)

Asynchronously sets a sequence of bytes in the specified cache with the specified key.

SetString(IDistributedCache, String, String, DistributedCacheEntryOptions)

Sets a string in the specified cache with the specified key.

SetString(IDistributedCache, String, String)

Sets a string in the specified cache with the specified key.

SetStringAsync(IDistributedCache, String, String, CancellationToken)

Asynchronously sets a string in the specified cache with the specified key.

SetStringAsync(IDistributedCache, String, String, DistributedCacheEntryOptions, CancellationToken)

Asynchronously sets a string in the specified cache with the specified key.

Applies to


Feedback

Was this page helpful?