improve cache modules. support mulit instances

This commit is contained in:
astaxie
2016-01-04 10:50:04 +08:00
parent 92d157736b
commit a03fa0fb73
5 changed files with 18 additions and 15 deletions

10
cache/file.go vendored
View File

@@ -29,10 +29,6 @@ import (
"time"
)
func init() {
Register("file", NewFileCache())
}
// FileCacheItem is basic unit of file cache adapter.
// it contains data and expire time.
type FileCacheItem struct {
@@ -59,7 +55,7 @@ type FileCache struct {
// NewFileCache Create new file cache with no config.
// the level and expiry need set in method StartAndGC as config string.
func NewFileCache() *FileCache {
func NewFileCache() Cache {
// return &FileCache{CachePath:FileCachePath, FileSuffix:FileCacheFileSuffix}
return &FileCache{}
}
@@ -272,3 +268,7 @@ func GobDecode(data []byte, to *FileCacheItem) error {
dec := gob.NewDecoder(buf)
return dec.Decode(&to)
}
func init() {
Register("file", NewFileCache)
}