SimpleCache Class

简单缓存服务实现类,内部使用了 IDistributedCache 实现分布式缓存。

Definition

Namespace: QuickAdmin.Service.Infrastructure
Assembly: QuickAdmin.Net (in QuickAdmin.Net.dll) Version: 2.0.13
C#
public class SimpleCache : ISimpleCache
Inheritance
object    SimpleCache
Implements
ISimpleCache

Remarks

设计 ISimpleCache/SimpleCache 的目的是为了更方便地进行缓存的使用:提供常用的字符串、值类型以及对象的存取方法,并提供了各个 GetOrSet 方法。

Constructors

SimpleCache 构造新实例。

Methods

Public Methods

GetT 获取对象。
GetAsyncT 获取对象。
GetOrSetT(string, FuncT, DistributedCacheEntryOptions) 获取或设置对象,可传入缓存选项来指定相对或绝对到期时间。
GetOrSetT(string, FuncT, TimeSpan?) 获取或设置对象。
GetOrSetAsyncT(string, FuncCancellationToken, TaskT, DistributedCacheEntryOptions, CancellationToken) 获取或设置对象,可传入缓存选项来指定相对或绝对到期时间。
GetOrSetAsyncT(string, FuncCancellationToken, TaskT, TimeSpan?, CancellationToken) 获取或设置对象。
GetOrSetString(string, Funcstring, DistributedCacheEntryOptions) 获取或设置字符串,可传入缓存选项来指定相对或绝对到期时间。
GetOrSetString(string, Funcstring, TimeSpan?) 获取或设置字符串。
GetOrSetStringAsync(string, FuncCancellationToken, Taskstring, DistributedCacheEntryOptions, CancellationToken) 获取或设置字符串,可传入缓存选项来指定相对或绝对到期时间。
GetOrSetStringAsync(string, FuncCancellationToken, Taskstring, TimeSpan?, CancellationToken) 获取或设置字符串。
GetOrSetValueT(string, FuncT?, DistributedCacheEntryOptions) 获取或设置值类型数据,可传入缓存选项来指定相对或绝对到期时间。
GetOrSetValueT(string, FuncT?, TimeSpan?) 获取或设置值类型数据。
GetOrSetValueAsyncT(string, FuncCancellationToken, TaskT?, DistributedCacheEntryOptions, CancellationToken) 获取或设置值类型数据,可传入缓存选项来指定相对或绝对到期时间。
GetOrSetValueAsyncT(string, FuncCancellationToken, TaskT?, TimeSpan?, CancellationToken) 获取或设置值类型数据。
GetString 获取字符串。
GetStringAsync 获取字符串。
GetValueT 获取值类型数据。
GetValueAsyncT 获取值类型数据。
Refresh 键刷指定键,并重置其到期时间(如果有的话)。
RefreshAsync 键刷指定键,并重置其到期时间(如果有的话)。
Remove 删除指定键。
RemoveAsync 删除指定键。
Set(string, object, DistributedCacheEntryOptions) 设置对象,可传入缓存选项来指定相对或绝对到期时间。
Set(string, object, TimeSpan?) 设置对象。
SetAsync(string, object, DistributedCacheEntryOptions, CancellationToken) 设置对象,可传入缓存选项来指定相对或绝对到期时间。
SetAsync(string, object, TimeSpan?, CancellationToken) 设置对象。
SetString(string, string, DistributedCacheEntryOptions) 设置字符串,可传入缓存选项来指定相对或绝对到期时间。
SetString(string, string, TimeSpan?) 设置字符串。
SetStringAsync(string, string, DistributedCacheEntryOptions, CancellationToken) 设置字符串,可传入缓存选项来指定相对或绝对到期时间。
SetStringAsync(string, string, TimeSpan?, CancellationToken) 设置字符串。

Protected Methods

ToBytes 将对象转为字节数据。

Fields

Protected Fields

cache 分布式缓存接口。

See Also