Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCacheNoFound = fmt.Errorf("cache no found") ErrFileNoNeedStore = fmt.Errorf("file no need store") )
Functions ¶
This section is empty.
Types ¶
type Description ¶
type Description struct { Name string `json:"name"` Size string `json:"size"` MD5 string `json:"md5"` ChangeTime int64 `json:"change_time"` }
Description describe the file cache request it is as the file cache KEY
type File ¶
type File interface { Name() string MD5() string AbsPath() string Dir() string SaveTo(string) error Equal(File) bool Size() int64 }
File describe the cache file instance
type Manager ¶
type Manager interface { Search(Description) (File, error) Store(File) error }
Manager describe the manager of file cache
func NewManager ¶
func NewManager(c ManagerConfig) (Manager, error)
NewManager get a new file cache manager
type ManagerConfig ¶
type ManagerConfig struct { CacheDir string `json:"cache_dir"` PoolSize int `json:"pool_size"` CacheMinSize int64 `json:"cache_min_size"` }
ManagerConfig describe the file cache manager config
Click to show internal directories.
Click to hide internal directories.