mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 13:30:56 +00:00
fixed uninitialized return error if StartAndGC fails
This commit is contained in:
parent
6eee223352
commit
29b60d6058
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