Add GetMulti method for Cache interface

This commit is contained in:
weizili.build17
2015-06-07 21:33:01 +08:00
parent b9852df51c
commit 970f0b460c
8 changed files with 258 additions and 1 deletions

10
cache/file.go vendored
View File

@@ -132,6 +132,16 @@ func (fc *FileCache) Get(key string) interface{} {
return to.Data
}
// GetMulti gets values from file cache.
// if non-exist or expired, return empty string.
func (fc *FileCache) GetMulti(keys []string) []interface{} {
var rc []interface{}
for _, key := range keys {
rc = append(rc, fc.Get(key))
}
return rc
}
// Put value into file cache.
// timeout means how long to keep this file, unit of ms.
// if timeout equals FileCacheEmbedExpiry(default is 0), cache this item forever.