README ¶ 使用方法 package main import ( "fmt" gofilecache "github.com/mimicode/go-filecache" ) func main() { cache := gofilecache.Default() cache.Set("xiaoming", "xiaoming", 300) val := cache.Get("xiaoming") fmt.Println(string(val)) } Expand ▾ Collapse ▴ Documentation ¶ Index ¶ type FileCache func Default() *FileCache func New(config FileCacheConfig) *FileCache func (fc *FileCache) Del(key string) func (fc *FileCache) Exists(key string) bool func (fc *FileCache) Get(key string) []byte func (fc *FileCache) Set(key, value string, exp int64) bool type FileCacheConfig Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ This section is empty. Types ¶ type FileCache ¶ type FileCache struct { // contains filtered or unexported fields } func Default ¶ func Default() *FileCache func New ¶ func New(config FileCacheConfig) *FileCache func (*FileCache) Del ¶ func (fc *FileCache) Del(key string) 删除缓存 func (*FileCache) Exists ¶ func (fc *FileCache) Exists(key string) bool 判断key是否存在 func (*FileCache) Get ¶ func (fc *FileCache) Get(key string) []byte func (*FileCache) Set ¶ func (fc *FileCache) Set(key, value string, exp int64) bool 设置缓存 type FileCacheConfig ¶ type FileCacheConfig struct { //缓存文件目录级别 PathLevel int //缓存目录 CachePath string //缓存文件后缀 CacheFileSuffix string //gc 概率 百万分只1 0 - 1000000 GcProbability int //目录权限 DirMode os.FileMode // contains filtered or unexported fields } 配置 Source Files ¶ View all Source files filecache.go Directories ¶ Show internal Expand all Path Synopsis simple Click to show internal directories. Click to hide internal directories.