首次提交
This commit is contained in:
33
aycache/cache.go
Normal file
33
aycache/cache.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package aycache
|
||||
|
||||
import (
|
||||
"github.com/ayflying/utility_go/ayCache/drive"
|
||||
"github.com/gogf/gf/v2/os/gcache"
|
||||
)
|
||||
|
||||
type Mod struct {
|
||||
client *gcache.Cache
|
||||
}
|
||||
|
||||
//func NewV1(_name ...string) *cache.Mod {
|
||||
// return pgk.Cache
|
||||
//}
|
||||
|
||||
func New(_name ...string) gcache.Adapter {
|
||||
|
||||
var cacheAdapterObj gcache.Adapter
|
||||
var name = "cache"
|
||||
if len(_name) > 0 {
|
||||
name = _name[0]
|
||||
}
|
||||
switch name {
|
||||
case "cache":
|
||||
cacheAdapterObj = drive.NewAdapterMemory()
|
||||
case "redis":
|
||||
cacheAdapterObj = drive.NewAdapterRedis()
|
||||
}
|
||||
|
||||
//var client = gcache.New()
|
||||
//client.SetAdapter(cacheAdapterObj)
|
||||
return cacheAdapterObj
|
||||
}
|
||||
Reference in New Issue
Block a user