StorageInterface 缓存存储接口
| 6 | |
| 7 | // StorageInterface 缓存存储接口 |
| 8 | type StorageInterface interface { |
| 9 | // Init 初始化 |
| 10 | Init() error |
| 11 | |
| 12 | // OpenReader 读取缓存 |
| 13 | OpenReader(key string, useStale bool, isPartial bool) (reader Reader, err error) |
| 14 | |
| 15 | // OpenWriter 打开缓存写入器等待写入 |
| 16 | // size 和 maxSize 可能为-1 |
| 17 | OpenWriter(key string, expiresAt int64, status int, headerSize int, bodySize int64, maxSize int64, isPartial bool) (Writer, error) |
| 18 | |
| 19 | // OpenFlushWriter 打开从其他媒介直接刷入的写入器 |
| 20 | OpenFlushWriter(key string, expiresAt int64, status int, headerSize int, bodySize int64) (Writer, error) |
| 21 | |
| 22 | // Delete 删除某个键值对应的缓存 |
| 23 | Delete(key string) error |
| 24 | |
| 25 | // Stat 统计缓存 |
| 26 | Stat() (*Stat, error) |
| 27 | |
| 28 | // TotalDiskSize 消耗的磁盘尺寸 |
| 29 | TotalDiskSize() int64 |
| 30 | |
| 31 | // TotalMemorySize 内存尺寸 |
| 32 | TotalMemorySize() int64 |
| 33 | |
| 34 | // CleanAll 清除所有缓存 |
| 35 | CleanAll() error |
| 36 | |
| 37 | // Purge 批量删除缓存 |
| 38 | // urlType 值为file|dir |
| 39 | Purge(keys []string, urlType string) error |
| 40 | |
| 41 | // Stop 停止缓存策略 |
| 42 | Stop() |
| 43 | |
| 44 | // Policy 获取当前存储的Policy |
| 45 | Policy() *serverconfigs.HTTPCachePolicy |
| 46 | |
| 47 | // UpdatePolicy 修改策略 |
| 48 | UpdatePolicy(newPolicy *serverconfigs.HTTPCachePolicy) |
| 49 | |
| 50 | // CanUpdatePolicy 检查策略是否可以更新 |
| 51 | CanUpdatePolicy(newPolicy *serverconfigs.HTTPCachePolicy) bool |
| 52 | |
| 53 | // AddToList 将缓存添加到列表 |
| 54 | AddToList(item *Item) |
| 55 | |
| 56 | // IgnoreKey 忽略某个Key,即不缓存某个Key |
| 57 | IgnoreKey(key string, maxSize int64) |
| 58 | |
| 59 | // CanSendfile 是否支持Sendfile |
| 60 | CanSendfile() bool |
| 61 | } |
no outgoing calls
no test coverage detected