Documentation ¶
Index ¶
- func Clear()
- func Delete(key string) (val interface{}, loaded bool)
- func DeleteExpired(ctx context.Context) uint64
- func Get(key string) (interface{}, bool)
- func GetWithExpire(key string) (interface{}, int64, bool)
- func Len() int
- func Read(r io.Reader) error
- func Set(key string, val interface{})
- func SetWithExpire(key string, val interface{}, expire time.Duration)
- func Stop()
- func ToMap(ctx context.Context) *sync.Map
- func ToRawMap(ctx context.Context) map[string]interface{}
- func Write(ctx context.Context, w io.Writer) error
- type Gache
- func DisableExpiredHook() Gache
- func EnableExpiredHook() Gache
- func Foreach(ctx context.Context, f func(string, interface{}, int64) bool) Gache
- func GetGache() Gache
- func New(opts ...Option) Gache
- func SetDefaultExpire(ex time.Duration) Gache
- func SetExpiredHook(f func(context.Context, string)) Gache
- type Map
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteExpired ¶
DeleteExpired deletes expired value from Gache it can be cancel using context
func GetWithExpire ¶ added in v1.1.8
GetWithExpire returns value & expire & exists from key
func Set ¶
func Set(key string, val interface{})
Set sets key-value to Gache using default expiration
func SetWithExpire ¶
SetWithExpire sets key-value & expiration to Gache
Types ¶
type Gache ¶
type Gache interface { Clear() Delete(string) (interface{}, bool) DeleteExpired(context.Context) uint64 DisableExpiredHook() Gache EnableExpiredHook() Gache Foreach(context.Context, func(string, interface{}, int64) bool) Gache Get(string) (interface{}, bool) GetWithExpire(string) (interface{}, int64, bool) Read(io.Reader) error Set(string, interface{}) SetDefaultExpire(time.Duration) Gache SetExpiredHook(f func(context.Context, string)) Gache SetWithExpire(string, interface{}, time.Duration) StartExpired(context.Context, time.Duration) Gache Len() int ToMap(context.Context) *sync.Map ToRawMap(context.Context) map[string]interface{} Write(context.Context, io.Writer) error Stop() }
Gache is base interface type
func DisableExpiredHook ¶
func DisableExpiredHook() Gache
DisableExpiredHook disables expired hook function
func EnableExpiredHook ¶
func EnableExpiredHook() Gache
EnableExpiredHook enables expired hook function
func SetDefaultExpire ¶
SetDefaultExpire set expire duration
type Map ¶ added in v1.1.13
type Map struct {
// contains filtered or unexported fields
}
func (*Map) LoadAndDelete ¶ added in v1.2.5
type Option ¶ added in v1.2.3
type Option func(g *gache) error
func WithDefaultExpiration ¶ added in v1.2.3
func WithDefaultExpirationString ¶ added in v1.2.3
Click to show internal directories.
Click to hide internal directories.