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

4
cache/memory.go vendored
View File

@@ -44,7 +44,7 @@ type MemoryCache struct {
}
// NewMemoryCache returns a new MemoryCache.
func NewMemoryCache() *MemoryCache {
func NewMemoryCache() Cache {
cache := MemoryCache{items: make(map[string]*MemoryItem)}
return &cache
}
@@ -234,5 +234,5 @@ func (bc *MemoryCache) itemExpired(name string) bool {
}
func init() {
Register("memory", NewMemoryCache())
Register("memory", NewMemoryCache)
}