C# Class Ivony.Caching.MemoryCacheProvider

实现一个使用内存缓存的缓存提供程序
Inheritance: ICacheProvider
Show file Open project: Ivony/Ivony.Caching

Public Methods

Method Description
Clear ( ) : void

清空缓存

Dispose ( ) : void

回收所有非托管资源

Get ( string key ) : object

获取缓存值

MemoryCacheProvider ( string name, Configuration configuration ) : System

创建内存缓存提供程序对象

MemoryCacheProvider ( string name, NameValueCollection configuration = null ) : System

创建内存缓存提供程序对象

Remove ( string cacheKey ) : void

移除指定键的缓存值

Set ( string key, object value, CachePolicyItem cachePolicy ) : void

设置缓存值

Private Methods

Method Description
CreateCacheItemPolicy ( CachePolicyItem cachePolicy ) : System.Runtime.Caching.CacheItemPolicy

根据现有缓存策略创建 MemoryCache 的缓存策略

Method Details

Clear() public method

清空缓存
public Clear ( ) : void
return void

Dispose() public method

回收所有非托管资源
public Dispose ( ) : void
return void

Get() public method

获取缓存值
public Get ( string key ) : object
key string 缓存键
return object

MemoryCacheProvider() public method

创建内存缓存提供程序对象
public MemoryCacheProvider ( string name, Configuration configuration ) : System
name string MemoryCache 的配置名称
configuration Configuration MemoryCache 配置信息
return System

MemoryCacheProvider() public method

创建内存缓存提供程序对象
public MemoryCacheProvider ( string name, NameValueCollection configuration = null ) : System
name string MemoryCache 的配置名称
configuration System.Collections.Specialized.NameValueCollection MemoryCache 配置信息
return System

Remove() public method

移除指定键的缓存值
public Remove ( string cacheKey ) : void
cacheKey string 缓存键
return void

Set() public method

设置缓存值
public Set ( string key, object value, CachePolicyItem cachePolicy ) : void
key string 缓存键
value object 缓存值
cachePolicy CachePolicyItem 缓存策略
return void