repo

package
v0.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repo

type Repo struct {
	DB    *gorm.DB
	Cache cache.Cache
}

Repo struct

func (*Repo) Close

func (r *Repo) Close() error

Close mysql connection

func (*Repo) DelCache

func (r *Repo) DelCache(ctx context.Context, key string)

DelCache 删除缓存

func (*Repo) GetCache

func (r *Repo) GetCache() cache.Cache

GetCache 获取 cache

func (*Repo) GetDB

func (r *Repo) GetDB() *gorm.DB

GetDB 获取 gorm.DB

func (*Repo) QueryCache

func (r *Repo) QueryCache(ctx context.Context, key string, data any, ttl time.Duration, query func(any) error) (err error)

QueryCache 查询启用缓存 缓存的更新策略使用 Cache Aside Pattern see: https://coolshell.cn/articles/17416.html

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL