mirror of
https://github.com/astaxie/beego.git
synced 2024-11-29 21:01:29 +00:00
Merge pull request #792 from haowang1013/develop
fixed uninitialized return error if StartAndGC fails
This commit is contained in:
commit
2dfe1fc61c
6
cache/cache.go
vendored
6
cache/cache.go
vendored
@ -81,13 +81,13 @@ func Register(name string, adapter Cache) {
|
|||||||
// Create a new cache driver by adapter name and config string.
|
// Create a new cache driver by adapter name and config string.
|
||||||
// config need to be correct JSON as string: {"interval":360}.
|
// config need to be correct JSON as string: {"interval":360}.
|
||||||
// it will start gc automatically.
|
// it will start gc automatically.
|
||||||
func NewCache(adapterName, config string) (adapter Cache, e error) {
|
func NewCache(adapterName, config string) (adapter Cache, err error) {
|
||||||
adapter, ok := adapters[adapterName]
|
adapter, ok := adapters[adapterName]
|
||||||
if !ok {
|
if !ok {
|
||||||
e = fmt.Errorf("cache: unknown adapter name %q (forgot to import?)", adapterName)
|
err = fmt.Errorf("cache: unknown adapter name %q (forgot to import?)", adapterName)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err := adapter.StartAndGC(config)
|
err = adapter.StartAndGC(config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
adapter = nil
|
adapter = nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user