基于go-redis v8的redis缓存工具包
Go to file
2021-12-10 16:08:46 +08:00
.gitignore 'update.gitignore' 2021-12-06 16:07:56 +08:00
cache_test.go 'updateoptionWithFunc' 2021-12-06 16:09:12 +08:00
cache.go 新增一个配置选项为redisClient 2021-12-10 16:08:46 +08:00
go.mod 提交 2021-12-06 16:03:12 +08:00
go.sum 提交 2021-12-06 16:03:12 +08:00
LICENSE 提交 2021-12-06 16:03:12 +08:00
README.md 📝更新文档 2021-12-06 16:32:51 +08:00
utils.go 提交 2021-12-06 16:03:12 +08:00

rds_cache_go

说明

rds_cache_go是基于go-redis的缓存工具包

安装

go get -u github.com/cowardmrx/rds_cache_go

使用

var caches = NewCache(WithHost("192.168.0.151"), WithPort("6379"), WithDB(13))

// PUT 
err := caches.Put("key1", "va", 1*time.Minute)

// PUT json
amap := map[string]interface{}{
	"data"  :   "data1"
}

amapJson,_ := json.Marshal(amap)

err := caches.Put("key2",amapJson,1 * time.Minute)

// Exist 
exist := caches.Exist("key2")

// Get
result := caches.Get("key2")

// Delete
result,err := caches.Delete("key2")

// Delete More
result,err = caches.Delete("key2","key3","key4")