Versions in this module Expand all Collapse all v2 v2.0.0 Sep 13, 2024 Changes in this version + const DurationNoExpire + func Contains(ctx context.Context, key interface{}) (bool, error) + func Data(ctx context.Context) (map[interface{}]interface{}, error) + func Get(ctx context.Context, key interface{}) (*gvar.Var, error) + func GetExpire(ctx context.Context, key interface{}) (time.Duration, error) + func GetOrSet(ctx context.Context, key interface{}, value interface{}, ...) (*gvar.Var, error) + func GetOrSetFunc(ctx context.Context, key interface{}, f Func, duration time.Duration) (*gvar.Var, error) + func GetOrSetFuncLock(ctx context.Context, key interface{}, f Func, duration time.Duration) (*gvar.Var, error) + func KeyStrings(ctx context.Context) ([]string, error) + func Keys(ctx context.Context) ([]interface{}, error) + func MustContains(ctx context.Context, key interface{}) bool + func MustData(ctx context.Context) map[interface{}]interface + func MustGet(ctx context.Context, key interface{}) *gvar.Var + func MustGetExpire(ctx context.Context, key interface{}) time.Duration + func MustGetOrSet(ctx context.Context, key interface{}, value interface{}, ...) *gvar.Var + func MustGetOrSetFunc(ctx context.Context, key interface{}, f Func, duration time.Duration) *gvar.Var + func MustGetOrSetFuncLock(ctx context.Context, key interface{}, f Func, duration time.Duration) *gvar.Var + func MustKeyStrings(ctx context.Context) []string + func MustKeys(ctx context.Context) []interface + func MustSize(ctx context.Context) int + func MustValues(ctx context.Context) []interface + func Remove(ctx context.Context, keys ...interface{}) (value *gvar.Var, err error) + func Removes(ctx context.Context, keys []interface{}) error + func Set(ctx context.Context, key interface{}, value interface{}, ...) error + func SetIfNotExist(ctx context.Context, key interface{}, value interface{}, ...) (bool, error) + func SetIfNotExistFunc(ctx context.Context, key interface{}, f Func, duration time.Duration) (bool, error) + func SetIfNotExistFuncLock(ctx context.Context, key interface{}, f Func, duration time.Duration) (bool, error) + func SetMap(ctx context.Context, data map[interface{}]interface{}, duration time.Duration) error + func Size(ctx context.Context) (int, error) + func Update(ctx context.Context, key interface{}, value interface{}) (oldValue *gvar.Var, exist bool, err error) + func UpdateExpire(ctx context.Context, key interface{}, duration time.Duration) (oldDuration time.Duration, err error) + func Values(ctx context.Context) ([]interface{}, error) + type Adapter interface + Clear func(ctx context.Context) error + Close func(ctx context.Context) error + Contains func(ctx context.Context, key interface{}) (bool, error) + Data func(ctx context.Context) (data map[interface{}]interface{}, err error) + Get func(ctx context.Context, key interface{}) (*gvar.Var, error) + GetExpire func(ctx context.Context, key interface{}) (time.Duration, error) + GetOrSet func(ctx context.Context, key interface{}, value interface{}, ...) (result *gvar.Var, err error) + GetOrSetFunc func(ctx context.Context, key interface{}, f Func, duration time.Duration) (result *gvar.Var, err error) + GetOrSetFuncLock func(ctx context.Context, key interface{}, f Func, duration time.Duration) (result *gvar.Var, err error) + Keys func(ctx context.Context) (keys []interface{}, err error) + Remove func(ctx context.Context, keys ...interface{}) (lastValue *gvar.Var, err error) + Set func(ctx context.Context, key interface{}, value interface{}, ...) error + SetIfNotExist func(ctx context.Context, key interface{}, value interface{}, ...) (ok bool, err error) + SetIfNotExistFunc func(ctx context.Context, key interface{}, f Func, duration time.Duration) (ok bool, err error) + SetIfNotExistFuncLock func(ctx context.Context, key interface{}, f Func, duration time.Duration) (ok bool, err error) + SetMap func(ctx context.Context, data map[interface{}]interface{}, duration time.Duration) error + Size func(ctx context.Context) (size int, err error) + Update func(ctx context.Context, key interface{}, value interface{}) (oldValue *gvar.Var, exist bool, err error) + UpdateExpire func(ctx context.Context, key interface{}, duration time.Duration) (oldDuration time.Duration, err error) + Values func(ctx context.Context) (values []interface{}, err error) + func NewAdapterMemory(lruCap ...int) Adapter + type AdapterMemory struct + func (c *AdapterMemory) Clear(ctx context.Context) error + func (c *AdapterMemory) Close(ctx context.Context) error + func (c *AdapterMemory) Contains(ctx context.Context, key interface{}) (bool, error) + func (c *AdapterMemory) Data(ctx context.Context) (map[interface{}]interface{}, error) + func (c *AdapterMemory) Get(ctx context.Context, key interface{}) (*gvar.Var, error) + func (c *AdapterMemory) GetExpire(ctx context.Context, key interface{}) (time.Duration, error) + func (c *AdapterMemory) GetOrSet(ctx context.Context, key interface{}, value interface{}, ...) (*gvar.Var, error) + func (c *AdapterMemory) GetOrSetFunc(ctx context.Context, key interface{}, f Func, duration time.Duration) (*gvar.Var, error) + func (c *AdapterMemory) GetOrSetFuncLock(ctx context.Context, key interface{}, f Func, duration time.Duration) (*gvar.Var, error) + func (c *AdapterMemory) Keys(ctx context.Context) ([]interface{}, error) + func (c *AdapterMemory) Remove(ctx context.Context, keys ...interface{}) (*gvar.Var, error) + func (c *AdapterMemory) Set(ctx context.Context, key interface{}, value interface{}, ...) error + func (c *AdapterMemory) SetIfNotExist(ctx context.Context, key interface{}, value interface{}, ...) (bool, error) + func (c *AdapterMemory) SetIfNotExistFunc(ctx context.Context, key interface{}, f Func, duration time.Duration) (bool, error) + func (c *AdapterMemory) SetIfNotExistFuncLock(ctx context.Context, key interface{}, f Func, duration time.Duration) (bool, error) + func (c *AdapterMemory) SetMap(ctx context.Context, data map[interface{}]interface{}, duration time.Duration) error + func (c *AdapterMemory) Size(ctx context.Context) (size int, err error) + func (c *AdapterMemory) Update(ctx context.Context, key interface{}, value interface{}) (oldValue *gvar.Var, exist bool, err error) + func (c *AdapterMemory) UpdateExpire(ctx context.Context, key interface{}, duration time.Duration) (oldDuration time.Duration, err error) + func (c *AdapterMemory) Values(ctx context.Context) ([]interface{}, error) + type Cache struct + func New(lruCap ...int) *Cache + func NewWithAdapter(adapter Adapter) *Cache + func (c *Cache) GetAdapter() Adapter + func (c *Cache) KeyStrings(ctx context.Context) ([]string, error) + func (c *Cache) MustContains(ctx context.Context, key interface{}) bool + func (c *Cache) MustData(ctx context.Context) map[interface{}]interface{} + func (c *Cache) MustGet(ctx context.Context, key interface{}) *gvar.Var + func (c *Cache) MustGetExpire(ctx context.Context, key interface{}) time.Duration + func (c *Cache) MustGetOrSet(ctx context.Context, key interface{}, value interface{}, ...) *gvar.Var + func (c *Cache) MustGetOrSetFunc(ctx context.Context, key interface{}, f Func, duration time.Duration) *gvar.Var + func (c *Cache) MustGetOrSetFuncLock(ctx context.Context, key interface{}, f Func, duration time.Duration) *gvar.Var + func (c *Cache) MustKeyStrings(ctx context.Context) []string + func (c *Cache) MustKeys(ctx context.Context) []interface{} + func (c *Cache) MustSize(ctx context.Context) int + func (c *Cache) MustValues(ctx context.Context) []interface{} + func (c *Cache) Removes(ctx context.Context, keys []interface{}) error + func (c *Cache) SetAdapter(adapter Adapter) + type Func func(ctx context.Context) (value interface{}, err error)