Documentation
¶
Index ¶
- type Store
- func (s *Store) GetBytes(key string) ([]byte, error)
- func (s *Store) GetBytesCtx(ctx context.Context, key string) ([]byte, error)
- func (s *Store) GetDel(key string) (string, error)
- func (s *Store) GetDelCtx(ctx context.Context, key string) (string, error)
- func (s *Store) GetInt(key string) (int, error)
- func (s *Store) GetInt64(key string) (int64, error)
- func (s *Store) GetInt64Ctx(ctx context.Context, key string) (int64, error)
- func (s *Store) GetIntCtx(ctx context.Context, key string) (int, error)
- func (s *Store) Read(key string, obj any) (bool, error)
- func (s *Store) ReadCtx(ctx context.Context, key string, obj any) (bool, error)
- func (s *Store) ReadOrGet(key string, obj any, gf func() (any, error), seconds ...int) error
- func (s *Store) ReadOrGetCtx(ctx context.Context, key string, obj any, ...) error
- func (s *Store) SetInt(key string, value int, seconds ...int) error
- func (s *Store) SetInt64(key string, value int64, seconds ...int) error
- func (s *Store) SetInt64Ctx(ctx context.Context, key string, value int64, seconds ...int) error
- func (s *Store) SetIntCtx(ctx context.Context, key string, value int, seconds ...int) error
- func (s *Store) SetString(key, value string, seconds ...int) error
- func (s *Store) SetStringCtx(ctx context.Context, key, value string, seconds ...int) error
- func (s *Store) Write(key string, obj any, seconds ...int) error
- func (s *Store) WriteCtx(ctx context.Context, key string, obj any, seconds ...int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
Store 键值存取器
func (*Store) GetBytesCtx ¶
GetBytesCtx 返回给定 key 所关联的 []byte 值
func (*Store) GetInt64Ctx ¶
GetInt64Ctx 返回给定 key 所关联的 int64 值
func (*Store) ReadOrGet ¶
ReadOrGet 将给定 key 所关联的值反序列化到 obj 对象
若给定 key 不存在则调用数据获取函数,调用成功时赋值至 obj 对象,并将其序列化后关联到给定 key seconds 为 key 的过期时间(秒)
func (*Store) ReadOrGetCtx ¶
func (s *Store) ReadOrGetCtx(ctx context.Context, key string, obj any, gf func(ctx context.Context) (any, error), seconds ...int) error
ReadOrGetCtx 将给定 key 所关联的值反序列化到 obj 对象
若给定 key 不存在则调用数据获取函数,调用成功时赋值至 obj 对象,并将其序列化后关联到给定 key seconds 为 key 的过期时间(秒)
func (*Store) SetInt64Ctx ¶
SetInt64Ctx 将 int64 value 关联到给定 key,seconds 为 key 的过期时间(秒)
func (*Store) SetStringCtx ¶
SetStringCtx 将 string value 关联到给定 key,seconds 为 key 的过期时间(秒)
Click to show internal directories.
Click to hide internal directories.