RedisCache 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
使用 Redis 的分布式缓存实现。
用作 StackExchange.Redis Redis 客户端。
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
- 继承
-
RedisCache
- 实现
构造函数
| 名称 | 说明 |
|---|---|
| RedisCache(IOptions<RedisCacheOptions>) |
初始化 的新 RedisCache实例。 |
方法
| 名称 | 说明 |
|---|---|
| Dispose() |
执行与释放、释放或重置非托管资源关联的应用程序定义任务。 |
| Get(String) |
获取具有给定键的值。 |
| GetAsync(String, CancellationToken) |
获取具有给定键的值。 |
| Refresh(String) |
根据缓存中的键刷新值,重置其滑动过期超时(如果有)。 |
| RefreshAsync(String, CancellationToken) |
根据缓存中的键刷新值,重置其滑动过期超时(如果有)。 |
| Remove(String) |
删除具有给定键的值。 |
| RemoveAsync(String, CancellationToken) |
删除具有给定键的值。 |
| Set(String, Byte[], DistributedCacheEntryOptions) |
使用给定键设置一个值。 |
| SetAsync(String, Byte[], DistributedCacheEntryOptions, CancellationToken) |
使用给定键设置值。 |
显式接口实现
| 名称 | 说明 |
|---|---|
| IBufferDistributedCache.Set(String, ReadOnlySequence<Byte>, DistributedCacheEntryOptions) |
使用 Redis 的分布式缓存实现。 用作 |
| IBufferDistributedCache.SetAsync(String, ReadOnlySequence<Byte>, DistributedCacheEntryOptions, CancellationToken) |
使用 Redis 的分布式缓存实现。 用作 |
| IBufferDistributedCache.TryGet(String, IBufferWriter<Byte>) |
使用 Redis 的分布式缓存实现。 用作 |
| IBufferDistributedCache.TryGetAsync(String, IBufferWriter<Byte>, CancellationToken) |
使用 Redis 的分布式缓存实现。 用作 |
扩展方法
| 名称 | 说明 |
|---|---|
| GetString(IDistributedCache, String) |
从具有指定键的指定缓存中获取字符串。 |
| GetStringAsync(IDistributedCache, String, CancellationToken) |
使用指定的键从指定的缓存中异步获取字符串。 |
| Set(IDistributedCache, String, Byte[]) |
使用指定的键设置指定缓存中的字节序列。 |
| SetAsync(IDistributedCache, String, Byte[], CancellationToken) |
使用指定的键异步设置指定缓存中的字节序列。 |
| SetString(IDistributedCache, String, String, DistributedCacheEntryOptions) |
使用指定的键设置指定缓存中的字符串。 |
| SetString(IDistributedCache, String, String) |
使用指定的键设置指定缓存中的字符串。 |
| SetStringAsync(IDistributedCache, String, String, CancellationToken) |
使用指定的键异步设置指定缓存中的字符串。 |
| SetStringAsync(IDistributedCache, String, String, DistributedCacheEntryOptions, CancellationToken) |
使用指定的键异步设置指定缓存中的字符串。 |