register interface to gob automatically
Showing
1 changed file
with
2 additions
and
0 deletions
| ... | @@ -147,6 +147,8 @@ func (this *FileCache) Get(key string) interface{} { | ... | @@ -147,6 +147,8 @@ func (this *FileCache) Get(key string) interface{} { |
| 147 | // timeout means how long to keep this file, unit of ms. | 147 | // timeout means how long to keep this file, unit of ms. |
| 148 | // if timeout equals FileCacheEmbedExpiry(default is 0), cache this item forever. | 148 | // if timeout equals FileCacheEmbedExpiry(default is 0), cache this item forever. |
| 149 | func (this *FileCache) Put(key string, val interface{}, timeout int64) error { | 149 | func (this *FileCache) Put(key string, val interface{}, timeout int64) error { |
| 150 | gob.Register(val) | ||
| 151 | |||
| 150 | filename := this.getCacheFileName(key) | 152 | filename := this.getCacheFileName(key) |
| 151 | var item FileCacheItem | 153 | var item FileCacheItem |
| 152 | item.Data = val | 154 | item.Data = val | ... | ... |
-
Please register or sign in to post a comment