C# 클래스 Ivony.Caching.DiskCacheManager

磁盘缓存管理器,磁盘缓存管理器负责打开调度文件打开和关闭,过期缓存清理等
상속: IDisposable
파일 보기 프로젝트 열기: Ivony/Ivony.Caching 1 사용 예제들

공개 메소드들

메소드 설명
DiskCacheManager ( string rootPath, bool persistMode = true ) : System

创建磁盘缓存管理器对象

Dispose ( ) : void

释放所有资源,删除文件夹

GetCachePolicy ( string cacheKey ) : CachePolicyItem

获取缓存策略对象

ReadStream ( string cacheKey ) : Task

读取一个流

Remove ( string cacheKey ) : void
SetCachePolicy ( string cacheKey, CachePolicyItem cachePolicy ) : void

设置缓存策略对象

ValidateCacheKey ( string cacheKey ) : string
WriteStream ( string cacheKey, MemoryStream data ) : Task
WriteStream ( string cacheKey, byte data ) : Task

비공개 메소드들

메소드 설명
AssignCacheDirectory ( ) : void

分配一个新的缓存目录(一般用于清除缓存)

Initialize ( ) : void
ReadStream ( FileStream stream ) : Task
WriteStream ( FileStream stream, MemoryStream data ) : Task

将数据写入文件流

메소드 상세

DiskCacheManager() 공개 메소드

创建磁盘缓存管理器对象
public DiskCacheManager ( string rootPath, bool persistMode = true ) : System
rootPath string 缓存文件存放的路径
persistMode bool 持久模式,在此模式下,重启后将尽可能的使用原来的缓存目录
리턴 System

Dispose() 공개 메소드

释放所有资源,删除文件夹
public Dispose ( ) : void
리턴 void

GetCachePolicy() 공개 메소드

获取缓存策略对象
public GetCachePolicy ( string cacheKey ) : CachePolicyItem
cacheKey string 缓存键
리턴 CachePolicyItem

ReadStream() 공개 메소드

读取一个流
public ReadStream ( string cacheKey ) : Task
cacheKey string 缓存键
리턴 Task

Remove() 공개 메소드

public Remove ( string cacheKey ) : void
cacheKey string
리턴 void

SetCachePolicy() 공개 메소드

设置缓存策略对象
public SetCachePolicy ( string cacheKey, CachePolicyItem cachePolicy ) : void
cacheKey string
cachePolicy CachePolicyItem
리턴 void

ValidateCacheKey() 공개 메소드

public ValidateCacheKey ( string cacheKey ) : string
cacheKey string
리턴 string

WriteStream() 공개 메소드

public WriteStream ( string cacheKey, MemoryStream data ) : Task
cacheKey string
data System.IO.MemoryStream
리턴 Task

WriteStream() 공개 메소드

public WriteStream ( string cacheKey, byte data ) : Task
cacheKey string
data byte
리턴 Task