xkv

package
v0.0.0-...-1369677 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CacheLaunchpadCorporationInfo 公司信息缓存
	// Cache:ServiceName:KeyPre 缓存key定义规范
	CacheLaunchpadCorporationInfo = "cache:launchpad:corporation"

	// CacheAdminMemberTokenPrefix 成员令牌数据缓存key前缀
	CacheAdminMemberTokenPrefix = "cache:admin:member_token:"

	// LimitNotifyEmailSubscribePrefix 订阅邮件key前缀
	// Limit:ServiceName:KeyPre 限流器key定义规范
	LimitNotifyEmailSubscribePrefix = "limit:notify:email:"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GetFunc

type GetFunc func() (interface{}, error)

GetFunc 给定key不存在时调用的数据获取函数

type Store

type Store struct {
	kv.Store
}

Store 键值存取器结构详情

func NewStore

func NewStore(c kv.KvConf) *Store

NewStore 新建键值存取器

func (*Store) GetBytes

func (s *Store) GetBytes(key string) ([]byte, error)

GetBytes 返回给定key所关联的[]byte值

func (*Store) GetDel

func (s *Store) GetDel(key string) (string, error)

GetDel 返回并删除给定key所关联的string值

func (*Store) GetInt

func (s *Store) GetInt(key string) (int, error)

GetInt 返回给定key所关联的int值

func (*Store) GetInt64

func (s *Store) GetInt64(key string) (int64, error)

GetInt64 返回给定key所关联的int64值

func (*Store) Read

func (s *Store) Read(key string, obj interface{}) (bool, error)

Read 将给定key所关联的值反序列化到obj对象 返回false时代表给定key不存在

func (*Store) ReadOrGet

func (s *Store) ReadOrGet(key string, obj interface{}, gf GetFunc, seconds ...int) error

ReadOrGet 将给定key所关联的值反序列化到obj对象 若给定key不存在则调用数据获取函数,调用成功时赋值至obj对象 并将其序列化后关联到给定key,seconds为key的过期时间(秒)

func (*Store) SetInt

func (s *Store) SetInt(key string, value int, seconds ...int) error

SetInt 将int value关联到给定key,seconds为key的过期时间(秒)

func (*Store) SetInt64

func (s *Store) SetInt64(key string, value int64, seconds ...int) error

SetInt64 将int64 value关联到给定key,seconds为key的过期时间(秒)

func (*Store) SetString

func (s *Store) SetString(key, value string, seconds ...int) error

SetString 将string value关联到给定key,seconds为key的过期时间(秒)

func (*Store) Write

func (s *Store) Write(key string, obj interface{}, seconds ...int) error

Write 将对象obj序列化后关联到给定key,seconds为key的过期时间(秒)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL