Documentation ¶
Index ¶
- func AfterCreate(cache *Gorm2Cache) func(db *gorm.DB)
- func AfterDelete(cache *Gorm2Cache) func(db *gorm.DB)
- func AfterQuery(cache *Gorm2Cache) func(db *gorm.DB)
- func AfterUpdate(cache *Gorm2Cache) func(db *gorm.DB)
- func BeforeQuery(cache *Gorm2Cache) func(db *gorm.DB)
- func GenInstanceId() string
- func GenSearchCacheKey(tableName string, sql string, vars ...interface{}) string
- type Gorm2Cache
- func (g *Gorm2Cache) CleanCache(key string) error
- func (g *Gorm2Cache) GetBean(key string, ptr any) error
- func (g *Gorm2Cache) GetHitCount() int64
- func (g *Gorm2Cache) IncrHitCount()
- func (g *Gorm2Cache) Initialize(db *gorm.DB) (err error)
- func (g *Gorm2Cache) IsCache(db *gorm.DB) bool
- func (g *Gorm2Cache) Name() string
- func (g *Gorm2Cache) ResetHitCount()
- func (g *Gorm2Cache) SetBean(key string, cacheValue any, expires int64) error
- func (g *Gorm2Cache) TableName(db *gorm.DB) string
- type Gorm2CacheConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AfterCreate ¶
func AfterCreate(cache *Gorm2Cache) func(db *gorm.DB)
func AfterDelete ¶
func AfterDelete(cache *Gorm2Cache) func(db *gorm.DB)
func AfterQuery ¶
func AfterQuery(cache *Gorm2Cache) func(db *gorm.DB)
func AfterUpdate ¶
func AfterUpdate(cache *Gorm2Cache) func(db *gorm.DB)
func BeforeQuery ¶
func BeforeQuery(cache *Gorm2Cache) func(db *gorm.DB)
func GenSearchCacheKey ¶
GenSearchCacheKey 生成搜索缓存key
Types ¶
type Gorm2Cache ¶
type Gorm2Cache struct { Config Gorm2CacheConfig // contains filtered or unexported fields }
func (*Gorm2Cache) GetHitCount ¶
func (g *Gorm2Cache) GetHitCount() int64
func (*Gorm2Cache) IncrHitCount ¶
func (g *Gorm2Cache) IncrHitCount()
func (*Gorm2Cache) Initialize ¶
func (g *Gorm2Cache) Initialize(db *gorm.DB) (err error)
func (*Gorm2Cache) Name ¶
func (g *Gorm2Cache) Name() string
func (*Gorm2Cache) ResetHitCount ¶
func (g *Gorm2Cache) ResetHitCount()
type Gorm2CacheConfig ¶
type Gorm2CacheConfig struct {
Enable bool `yaml:"enable"` // 是否开启缓存
}
Click to show internal directories.
Click to hide internal directories.