文件名称:gcache:gcache是gorm的中间件,插入后gorm即刻拥有缓存
文件大小:44KB
文件格式:ZIP
更新时间:2024-05-28 05:47:22
cache gorm gorm-cache gcache Go
gcache gcache是gorm的中间件,插入后gorm即刻拥有缓存。 Overview 即插即用 旁路缓存 数据源使用 Redis 防击穿 防穿透 安装 $ go get github.com/8treenet/gcache 快速使用 import ( "github.com/8treenet/gcache" "github.com/jinzhu/gorm" "github.com/8treenet/gcache/option"" ) func init() { //创建 gorm.DB db, _ = gorm.Open("mysql", "") opt := option.DefaultOption{} opt.Expires = 300 //缓存时间, 默认120秒。范围30-43200
【文件预览】:
gcache-master
----.gitignore(23B)
----README.md(2KB)
----option()
--------options.go(3KB)
----driver()
--------utils.go(15KB)
--------driver.go(2KB)
--------connection.go(2KB)
--------connector.go(546B)
--------rows.go(3KB)
----LICENSE(11KB)
----go.mod(223B)
----example()
--------example_test.go(11KB)
----internal()
--------call_delete.go(2KB)
--------call_create.go(2KB)
--------search.go(835B)
--------call_update.go(2KB)
--------call_row.go(2KB)
--------handle_create.go(5KB)
--------call_query.go(4KB)
--------handle_query.go(6KB)
--------easy_scope.go(15KB)
--------redis.go(2KB)
--------refresh_test.go(3KB)
--------singleflight.go(3KB)
--------gcache.go(2KB)
--------handle_update.go(917B)
--------handle_manager.go(3KB)
--------handle_delete.go(5KB)
----go.sum(5KB)
----gcache.go(1KB)