register interface to gob automatically

This commit is contained in:
Pengfei Xue 2014-02-14 17:52:57 +08:00 committed by asta.xie
parent 97b68bdd66
commit 5d02b18db4
1 changed files with 2 additions and 0 deletions

2
cache/file.go vendored
View File

@ -147,6 +147,8 @@ func (this *FileCache) Get(key string) interface{} {
// timeout means how long to keep this file, unit of ms.
// if timeout equals FileCacheEmbedExpiry(default is 0), cache this item forever.
func (this *FileCache) Put(key string, val interface{}, timeout int64) error {
gob.Register(val)
filename := this.getCacheFileName(key)
var item FileCacheItem
item.Data = val