Documentation
¶
Index ¶
- func New(config any) (driver.Driver, error)
- type GoCacheConfig
- type GoCacheDriver
- func (g *GoCacheDriver) Add(k string, v any, d time.Duration) error
- func (g *GoCacheDriver) DecrementInt(k string, n int) (int, error)
- func (g *GoCacheDriver) DecrementInt64(k string, n int64) (int64, error)
- func (g *GoCacheDriver) DecrementUint(k string, n uint) (uint, error)
- func (g *GoCacheDriver) DecrementUint64(k string, n uint64) (uint64, error)
- func (g *GoCacheDriver) Delete(k string)
- func (g *GoCacheDriver) DeleteExpired()
- func (g *GoCacheDriver) Flush()
- func (g *GoCacheDriver) Get(k string) (any, bool)
- func (g *GoCacheDriver) GetWithExpiration(k string) (any, time.Time, bool)
- func (g *GoCacheDriver) IncrementInt(k string, n int) (int, error)
- func (g *GoCacheDriver) IncrementInt64(k string, n int64) (int64, error)
- func (g *GoCacheDriver) IncrementUint(k string, n uint) (uint, error)
- func (g *GoCacheDriver) IncrementUint64(k string, n uint64) (uint64, error)
- func (g *GoCacheDriver) Replace(k string, x any, d time.Duration) error
- func (g *GoCacheDriver) Set(k string, x any, d time.Duration)
- func (g *GoCacheDriver) SetDefault(k string, x any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GoCacheConfig ¶
type GoCacheDriver ¶
type GoCacheDriver struct {
// contains filtered or unexported fields
}
func (*GoCacheDriver) DecrementInt ¶
func (g *GoCacheDriver) DecrementInt(k string, n int) (int, error)
func (*GoCacheDriver) DecrementInt64 ¶
func (g *GoCacheDriver) DecrementInt64(k string, n int64) (int64, error)
func (*GoCacheDriver) DecrementUint ¶
func (g *GoCacheDriver) DecrementUint(k string, n uint) (uint, error)
func (*GoCacheDriver) DecrementUint64 ¶
func (g *GoCacheDriver) DecrementUint64(k string, n uint64) (uint64, error)
func (*GoCacheDriver) Delete ¶
func (g *GoCacheDriver) Delete(k string)
Delete 从缓存中删除一个项目。如果密钥不在缓存中,则不执行任何操作。
func (*GoCacheDriver) Get ¶
func (g *GoCacheDriver) Get(k string) (any, bool)
Get 从缓存中获取一个项目。返回该项或 nil,以及一个指示是否找到该键的布尔值。
func (*GoCacheDriver) GetWithExpiration ¶
GetWithExpiration 从缓存中返回一个项目及其过期时间。它返回该项目或 nil、过期时间(如果已设置) (如果该项目永不过期,则返回时间的零值。Time 返回) 以及指示是否找到该键的 bool。
func (*GoCacheDriver) IncrementInt ¶
func (g *GoCacheDriver) IncrementInt(k string, n int) (int, error)
func (*GoCacheDriver) IncrementInt64 ¶
func (g *GoCacheDriver) IncrementInt64(k string, n int64) (int64, error)
func (*GoCacheDriver) IncrementUint ¶
func (g *GoCacheDriver) IncrementUint(k string, n uint) (uint, error)
func (*GoCacheDriver) IncrementUint64 ¶
func (g *GoCacheDriver) IncrementUint64(k string, n uint64) (uint64, error)
func (*GoCacheDriver) Set ¶
func (g *GoCacheDriver) Set(k string, x any, d time.Duration)
Set 添加/替换现有的缓存设置,包括过期时间,如果过期时间是0,则使用默认过期时间,如果为-1则表示永不过期
func (*GoCacheDriver) SetDefault ¶
func (g *GoCacheDriver) SetDefault(k string, x any)
SetDefault 添加/替换现有的缓存设置,使用默认过期时间
Click to show internal directories.
Click to hide internal directories.