Documentation ¶
Index ¶
- Variables
- func CleanExpiredCache()
- func ClearCache() error
- func DeleteCache(key string) error
- func GetCacheValue[T any](key string) (T, time.Time, error)
- func GetCurrentGroup() int
- func LoadCacheFromDB()
- func SetCache(key string, data interface{}, expir time.Time)
- func SetCurrentGroup(group int)
- func UpdateHitCounts()
- type CacheItem
- type UserInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var CacheMap = sync.Map{}
View Source
var HitCounts = sync.Map{}
Functions ¶
func GetCacheValue ¶ added in v1.8.6
获取缓存值的泛型方法
func GetCurrentGroup ¶
func GetCurrentGroup() int
func SetCurrentGroup ¶
func SetCurrentGroup(group int)
Types ¶
type CacheItem ¶
type CacheItem struct { Key string `gorm:"primaryKey"` Group int `gorm:"column:group" json:"Group" form:"Group" comment:"Group"` Data []byte `gorm:"column:data" json:"Data" form:"Data" comment:"Data"` Expir time.Time `gorm:"column:expir" json:"Expir" form:"Expir" comment:"Expir"` HitCount int `gorm:"column:hit_count" json:"HitCount" form:"HitCount" comment:"HitCount"` CreatedAt time.Time `gorm:"column:created_at" json:"CreatedAt" form:"CreatedAt" comment:"CreatedAt"` }
定义缓存项的结构体
Click to show internal directories.
Click to hide internal directories.