1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 17:40:55 +00:00

Merge pull request #3506 from DennisMao/hotfixFileCachePanic

fix panic cause by the map
This commit is contained in:
astaxie 2019-02-02 16:38:11 +08:00 committed by GitHub
commit b6854aaf9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

2
cache/file.go vendored
View File

@ -65,7 +65,7 @@ func NewFileCache() Cache {
// the config need to be like {CachePath:"/cache","FileSuffix":".bin","DirectoryLevel":2,"EmbedExpiry":0} // the config need to be like {CachePath:"/cache","FileSuffix":".bin","DirectoryLevel":2,"EmbedExpiry":0}
func (fc *FileCache) StartAndGC(config string) error { func (fc *FileCache) StartAndGC(config string) error {
var cfg map[string]string cfg := make(map[string]string)
json.Unmarshal([]byte(config), &cfg) json.Unmarshal([]byte(config), &cfg)
if _, ok := cfg["CachePath"]; !ok { if _, ok := cfg["CachePath"]; !ok {
cfg["CachePath"] = FileCachePath cfg["CachePath"] = FileCachePath