Documentation ¶
Overview ¶
用文件形式存储远程资源
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DumpCacheObject ¶
func DumpCacheObject(w io.Writer, oc *CacheObject) error
Types ¶
type CacheObject ¶
type CacheObject struct { Source string // 源地址 Length uint64 // 长度 MD5Hash [16]byte // 内容 hash 值 CreatedAt time.Time // 缓存创建的时间 Object []byte // 缓存的内容 }
func LoadCacheObject ¶
func LoadCacheObject(r io.Reader) (*CacheObject, error)
type FileStorage ¶
func NewFileStorage ¶
func NewFileStorage(path string) *FileStorage
func (*FileStorage) Delete ¶
func (fs *FileStorage) Delete(key string) error
func (*FileStorage) Get ¶
func (fs *FileStorage) Get(key string) (*CacheObject, error)
func (*FileStorage) Set ¶
func (fs *FileStorage) Set(key string, oc *CacheObject) error
type Storager ¶
type Storager interface { Get(key string) (*CacheObject, error) Set(key string, oc *CacheObject) error Delete(key string) error }
Click to show internal directories.
Click to hide internal directories.