1 Star 2 Fork 3

kristas/booting-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
map_cache.go 834 Bytes
一键复制 编辑 原始数据 按行查看 历史
kristas 提交于 2021-04-10 00:37 . fix: bug fix
package default_map_cache_impl
import (
"gitee.com/kristas/booting-go/framework/common/cache/cache_factory"
"gitee.com/kristas/booting-go/framework/common/tool/ccmap"
"gitee.com/kristas/booting-go/framework/core/bean"
)
func init() {
cache_factory.Register("default", new(MapCache))
}
type MapCache struct {
bean.DefaultBean
cache_factory.DefaultCacheImpl
cacheMap *ccmap.ConcurrentMap
}
func (r *MapCache) Conn() (cache_factory.ICache, error) {
r.cacheMap = ccmap.NewConcurrentMap()
return r, nil
}
func (r *MapCache) Save(key string, value interface{}) (interface{}, error) {
r.cacheMap.Set(key, value)
return "OK", nil
}
func (r *MapCache) Del(key string) (interface{}, error) {
r.cacheMap.Delete(key)
return 1, nil
}
func (r *MapCache) Get(key string) (interface{}, error) {
return r.cacheMap.Get(key), nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/kristas/booting-go.git
git@gitee.com:kristas/booting-go.git
kristas
booting-go
booting-go
v1.1.7

搜索帮助