Documentation ¶
Index ¶
- Constants
- Variables
- func AcfunLiveInfoKey(keys ...interface{}) string
- func AcfunNotLiveKey(keys ...interface{}) string
- func AcfunUidFirstTimestampKey(keys ...interface{}) string
- func AcfunUserInfoKey(keys ...interface{}) string
- func BilibiliActiveTimestampKey(keys ...interface{}) string
- func BilibiliCompactMarkKey(keys ...interface{}) string
- func BilibiliCurrentLiveKey(keys ...interface{}) string
- func BilibiliCurrentNewsKey(keys ...interface{}) string
- func BilibiliDynamicIdKey(keys ...interface{}) string
- func BilibiliGroupAtAllMarkKey(keys ...interface{}) string
- func BilibiliGroupConcernConfigKey(keys ...interface{}) string
- func BilibiliGroupConcernStateKey(keys ...interface{}) string
- func BilibiliLastFreshKey(keys ...interface{}) string
- func BilibiliNotLiveCountKey(keys ...interface{}) string
- func BilibiliNotifyMsgKey(keys ...interface{}) string
- func BilibiliUidFirstTimestampKey(keys ...interface{}) string
- func BilibiliUserCookieInfoKey(keys ...interface{}) string
- func BilibiliUserInfoKey(keys ...interface{}) string
- func BilibiliUserStatKey(keys ...interface{}) string
- func BilibliFreshKey(keys ...interface{}) string
- func BlockListKey(keys ...interface{}) string
- func Close() error
- func CreatePatternIndex(patternFunc KeyPatternFunc, suffix []interface{}, ...) error
- func DDBotNoUpdateKey(keys ...interface{}) string
- func DDBotReleaseKey(keys ...interface{}) string
- func Delete(key string, opt ...OptionFunc) (string, error)
- func DeleteInt64(key string, opt ...OptionFunc) (int64, error)
- func DouyuCurrentLiveKey(keys ...interface{}) string
- func DouyuFreshKey(keys ...interface{}) string
- func DouyuGroupAtAllMarkKey(keys ...interface{}) string
- func DouyuGroupConcernConfigKey(keys ...interface{}) string
- func DouyuGroupConcernStateKey(keys ...interface{}) string
- func Exist(key string, opt ...OptionFunc) bool
- func ExpireOption(duration time.Duration) *buntdb.SetOptions
- func Get(key string, opt ...OptionFunc) (string, error)
- func GetClient() (*buntdb.DB, error)
- func GetInt64(key string, opt ...OptionFunc) (int64, error)
- func GetJson(key string, obj interface{}, opt ...OptionFunc) error
- func GlobalEnabledKey(keys ...interface{}) string
- func GlobalSilenceKey(keys ...interface{}) string
- func GroupEnabledKey(keys ...interface{}) string
- func GroupInvitedKey(keys ...interface{}) string
- func GroupInvitorKey(keys ...interface{}) string
- func GroupMessageImageKey(keys ...interface{}) string
- func GroupMuteKey(keys ...interface{}) string
- func GroupPermissionKey(keys ...interface{}) string
- func GroupSilenceKey(keys ...interface{}) string
- func HuyaCurrentLiveKey(keys ...interface{}) string
- func HuyaFreshKey(keys ...interface{}) string
- func HuyaGroupAtAllMarkKey(keys ...interface{}) string
- func HuyaGroupConcernConfigKey(keys ...interface{}) string
- func HuyaGroupConcernStateKey(keys ...interface{}) string
- func ImageCacheKey(keys ...interface{}) string
- func IncInt64(key string, value int64) (int64, error)
- func InitBuntDB(dbpath string) error
- func IsNotFound(e error) bool
- func IsRollback(e error) bool
- func Key(keys ...interface{}) string
- func LoliconPoolStoreKey(keys ...interface{}) string
- func ModeKey() string
- func MustGetClient() *buntdb.DB
- func NamedKey(name string, keys []interface{}) string
- func NewFriendRequestKey(keys ...interface{}) string
- func ParseConcernStateKeyWithInt64(key string) (groupCode int64, id int64, err error)
- func ParseConcernStateKeyWithString(key string) (groupCode int64, id string, err error)
- func PermissionKey(keys ...interface{}) string
- func RCover(f func() error) error
- func RCoverTx(f func(tx *buntdb.Tx) error) error
- func RWCover(f func() error) error
- func RWCoverTx(f func(tx *buntdb.Tx) error) error
- func RemoveByPrefixAndIndex(prefixKey []string, indexKey []string) ([]string, error)
- func SeqNext(key string) (int64, error)
- func Set(key, value string, opt ...OptionFunc) error
- func SetInt64(key string, value int64, opt ...OptionFunc) error
- func SetJson(key string, obj interface{}, opt ...OptionFunc) error
- func VersionKey(keys ...interface{}) string
- func WeiboMarkMblogIdKey(keys ...interface{}) string
- func WeiboNewsInfoKey(keys ...interface{}) string
- func WeiboUserInfoKey(keys ...interface{}) string
- func YoutubeFreshKey(keys ...interface{}) string
- func YoutubeGroupAtAllMarkKey(keys ...interface{}) string
- func YoutubeGroupConcernConfigKey(keys ...interface{}) string
- func YoutubeGroupConcernStateKey(keys ...interface{}) string
- func YoutubeInfoKey(keys ...interface{}) string
- func YoutubeUserInfoKey(keys ...interface{}) string
- func YoutubeVideoKey(keys ...interface{}) string
- type KeyPatternFunc
- type OptionFunc
- func GetIgnoreExpireOpt() OptionFunc
- func GetTTLOpt(ttl *time.Duration) OptionFunc
- func IgnoreNotFoundOpt() OptionFunc
- func SetExpireOpt(expire time.Duration) OptionFunc
- func SetGetIsOverwriteOpt(isOverWrite *bool) OptionFunc
- func SetGetPreviousValueInt64Opt(previous *int64) OptionFunc
- func SetGetPreviousValueJsonObjectOpt(previous interface{}) OptionFunc
- func SetGetPreviousValueStringOpt(previous *string) OptionFunc
- func SetKeepLastExpireOpt() OptionFunc
- func SetNoOverWriteOpt() OptionFunc
- type ShortCut
- func (s *ShortCut) CreatePatternIndex(patternFunc KeyPatternFunc, suffix []interface{}, ...) error
- func (s *ShortCut) Delete(key string, opt ...OptionFunc) (string, error)
- func (s *ShortCut) DeleteInt64(key string, opt ...OptionFunc) (int64, error)
- func (s *ShortCut) Exist(key string, opt ...OptionFunc) bool
- func (s *ShortCut) Get(key string, opt ...OptionFunc) (string, error)
- func (s *ShortCut) GetInt64(key string, opt ...OptionFunc) (int64, error)
- func (s *ShortCut) GetJson(key string, obj interface{}, opt ...OptionFunc) error
- func (s *ShortCut) IncInt64(key string, value int64) (int64, error)
- func (*ShortCut) RCover(f func() error) error
- func (*ShortCut) RCoverTx(f func(tx *buntdb.Tx) error) error
- func (*ShortCut) RWCover(f func() error) error
- func (*ShortCut) RWCoverTx(f func(tx *buntdb.Tx) error) error
- func (s *ShortCut) SeqNext(key string) (int64, error)
- func (s *ShortCut) Set(key, value string, opt ...OptionFunc) error
- func (s *ShortCut) SetInt64(key string, value int64, opt ...OptionFunc) error
- func (s *ShortCut) SetJson(key string, obj interface{}, opt ...OptionFunc) error
Constants ¶
const LSPDB = ".lsp.db"
const MEMORYDB = ":memory:"
Variables ¶
Functions ¶
func AcfunLiveInfoKey ¶ added in v1.0.0
func AcfunLiveInfoKey(keys ...interface{}) string
func AcfunNotLiveKey ¶ added in v1.0.0
func AcfunNotLiveKey(keys ...interface{}) string
func AcfunUidFirstTimestampKey ¶ added in v1.0.0
func AcfunUidFirstTimestampKey(keys ...interface{}) string
func AcfunUserInfoKey ¶ added in v1.0.0
func AcfunUserInfoKey(keys ...interface{}) string
func BilibiliActiveTimestampKey ¶ added in v1.0.5
func BilibiliActiveTimestampKey(keys ...interface{}) string
func BilibiliCompactMarkKey ¶ added in v1.0.0
func BilibiliCompactMarkKey(keys ...interface{}) string
func BilibiliCurrentLiveKey ¶
func BilibiliCurrentLiveKey(keys ...interface{}) string
func BilibiliCurrentNewsKey ¶
func BilibiliCurrentNewsKey(keys ...interface{}) string
func BilibiliDynamicIdKey ¶
func BilibiliDynamicIdKey(keys ...interface{}) string
func BilibiliGroupAtAllMarkKey ¶ added in v0.0.10
func BilibiliGroupAtAllMarkKey(keys ...interface{}) string
func BilibiliGroupConcernConfigKey ¶ added in v0.0.10
func BilibiliGroupConcernConfigKey(keys ...interface{}) string
func BilibiliGroupConcernStateKey ¶
func BilibiliGroupConcernStateKey(keys ...interface{}) string
func BilibiliLastFreshKey ¶ added in v1.0.0
func BilibiliLastFreshKey(keys ...interface{}) string
func BilibiliNotLiveCountKey ¶ added in v0.0.7
func BilibiliNotLiveCountKey(keys ...interface{}) string
func BilibiliNotifyMsgKey ¶ added in v1.0.0
func BilibiliNotifyMsgKey(keys ...interface{}) string
func BilibiliUidFirstTimestampKey ¶ added in v0.0.6
func BilibiliUidFirstTimestampKey(keys ...interface{}) string
func BilibiliUserCookieInfoKey ¶ added in v0.0.17
func BilibiliUserCookieInfoKey(keys ...interface{}) string
func BilibiliUserInfoKey ¶
func BilibiliUserInfoKey(keys ...interface{}) string
func BilibiliUserStatKey ¶ added in v0.0.19
func BilibiliUserStatKey(keys ...interface{}) string
func BilibliFreshKey ¶
func BilibliFreshKey(keys ...interface{}) string
func BlockListKey ¶
func BlockListKey(keys ...interface{}) string
func CreatePatternIndex ¶ added in v0.1.4
func CreatePatternIndex(patternFunc KeyPatternFunc, suffix []interface{}, less ...func(a, b string) bool) error
func DDBotNoUpdateKey ¶ added in v1.0.6
func DDBotNoUpdateKey(keys ...interface{}) string
func DDBotReleaseKey ¶ added in v1.0.6
func DDBotReleaseKey(keys ...interface{}) string
func Delete ¶ added in v1.0.0
func Delete(key string, opt ...OptionFunc) (string, error)
Delete 删除key,并返回key上的值 支持 IgnoreNotFoundOpt
func DeleteInt64 ¶ added in v1.0.0
func DeleteInt64(key string, opt ...OptionFunc) (int64, error)
DeleteInt64 删除key,解析key上的值到int64并返回 支持 IgnoreNotFoundOpt
func DouyuCurrentLiveKey ¶
func DouyuCurrentLiveKey(keys ...interface{}) string
func DouyuFreshKey ¶
func DouyuFreshKey(keys ...interface{}) string
func DouyuGroupAtAllMarkKey ¶ added in v0.0.10
func DouyuGroupAtAllMarkKey(keys ...interface{}) string
func DouyuGroupConcernConfigKey ¶ added in v0.0.10
func DouyuGroupConcernConfigKey(keys ...interface{}) string
func DouyuGroupConcernStateKey ¶
func DouyuGroupConcernStateKey(keys ...interface{}) string
func Exist ¶ added in v1.0.0
func Exist(key string, opt ...OptionFunc) bool
Exist 查询key是否存在,key不存在或者发生任何错误时返回 false 支持 GetTTLOpt GetIgnoreExpireOpt
func ExpireOption ¶
func ExpireOption(duration time.Duration) *buntdb.SetOptions
ExpireOption 是一个创建 buntdb.SetOptions 的函数糖,当直接操作底层buntdb的时候可以使用。 使用本package的时候请使用 SetExpireOpt
func Get ¶ added in v1.0.0
func Get(key string, opt ...OptionFunc) (string, error)
Get 通过key获取value 支持 GetIgnoreExpireOpt IgnoreNotFoundOpt GetTTLOpt
func GetInt64 ¶ added in v0.1.4
func GetInt64(key string, opt ...OptionFunc) (int64, error)
GetInt64 通过key获取value,并将value解析成int64 支持 GetIgnoreExpireOpt IgnoreNotFoundOpt GetTTLOpt 当设置了 IgnoreNotFoundOpt 时,key不存在时会直接返回0
func GetJson ¶ added in v1.0.0
func GetJson(key string, obj interface{}, opt ...OptionFunc) error
GetJson 获取key对应的value,并通过 json.Unmarshal 到obj上 支持 GetIgnoreExpireOpt IgnoreNotFoundOpt GetTTLOpt
func GlobalEnabledKey ¶ added in v0.0.16
func GlobalEnabledKey(keys ...interface{}) string
func GlobalSilenceKey ¶ added in v0.1.3
func GlobalSilenceKey(keys ...interface{}) string
func GroupEnabledKey ¶
func GroupEnabledKey(keys ...interface{}) string
func GroupInvitedKey ¶ added in v0.1.0
func GroupInvitedKey(keys ...interface{}) string
func GroupInvitorKey ¶
func GroupInvitorKey(keys ...interface{}) string
func GroupMessageImageKey ¶
func GroupMessageImageKey(keys ...interface{}) string
func GroupMuteKey ¶
func GroupMuteKey(keys ...interface{}) string
func GroupPermissionKey ¶
func GroupPermissionKey(keys ...interface{}) string
func GroupSilenceKey ¶ added in v0.1.3
func GroupSilenceKey(keys ...interface{}) string
func HuyaCurrentLiveKey ¶ added in v0.0.7
func HuyaCurrentLiveKey(keys ...interface{}) string
func HuyaFreshKey ¶ added in v0.0.7
func HuyaFreshKey(keys ...interface{}) string
func HuyaGroupAtAllMarkKey ¶ added in v0.0.10
func HuyaGroupAtAllMarkKey(keys ...interface{}) string
func HuyaGroupConcernConfigKey ¶ added in v0.0.10
func HuyaGroupConcernConfigKey(keys ...interface{}) string
func HuyaGroupConcernStateKey ¶ added in v0.0.7
func HuyaGroupConcernStateKey(keys ...interface{}) string
func ImageCacheKey ¶
func ImageCacheKey(keys ...interface{}) string
func IncInt64 ¶ added in v1.0.0
IncInt64 将key上的int64值加上 value 并保存,返回保存后的值。 如果key不存在,则会默认其为0,返回值为1 如果key上的value不是一个int64,则会返回错误
func IsNotFound ¶ added in v1.0.0
func IsRollback ¶ added in v0.0.10
func LoliconPoolStoreKey ¶
func LoliconPoolStoreKey(keys ...interface{}) string
func MustGetClient ¶
MustGetClient 获取 buntdb.DB 对象,如果没有初始化会panic,在编写订阅组件时可以放心调用
func NewFriendRequestKey ¶ added in v0.1.0
func NewFriendRequestKey(keys ...interface{}) string
func ParseConcernStateKeyWithInt64 ¶ added in v0.0.7
func ParseConcernStateKeyWithString ¶ added in v0.0.7
func PermissionKey ¶
func PermissionKey(keys ...interface{}) string
func RWCover ¶ added in v0.1.0
RWCover 在一个可读可写事务中执行f,不同的是它不获取 buntdb.Tx ,而由 f 自己控制。 需要注意可写事务是唯一的,同一时间只会存在一个可写事务,所有耗时操作禁止放在可写事务中执行 在同一Goroutine中,可写事务可以嵌套
func RWCoverTx ¶ added in v0.0.19
RWCoverTx 在一个可读可写事务中执行f,注意f的返回值不一定是RWCoverTx的返回值 有可能f返回nil,但RWTxCover返回non-nil 可以忽略error,但不要简单地用f返回值替代RWTxCover返回值,ref: bilibili/MarkDynamicId 需要注意可写事务是唯一的,同一时间只会存在一个可写事务,所有耗时操作禁止放在可写事务中执行 在同一Goroutine中,可写事务可以嵌套
func RemoveByPrefixAndIndex ¶ added in v0.0.19
RemoveByPrefixAndIndex 遍历每个index,如果一个key满足任意prefix,则删掉
func SeqNext ¶ added in v0.1.2
SeqNext 将key上的int64值加上1并保存,返回保存后的值。 如果key不存在,则会默认其为0,返回值为1 等价于 IncInt64(key, 1)
func Set ¶ added in v1.0.0
func Set(key, value string, opt ...OptionFunc) error
Set 通过key设置value 支持 SetExpireOpt SetKeepLastExpireOpt SetNoOverWriteOpt SetGetIsOverwriteOpt SetGetPreviousValueStringOpt SetGetPreviousValueInt64Opt SetGetPreviousValueJsonObjectOpt
func SetInt64 ¶ added in v0.1.4
func SetInt64(key string, value int64, opt ...OptionFunc) error
SetInt64 通过key设置int64格式的value 支持 SetExpireOpt SetKeepLastExpireOpt SetNoOverWriteOpt SetGetIsOverwriteOpt SetGetPreviousValueStringOpt SetGetPreviousValueInt64Opt SetGetPreviousValueJsonObjectOpt
func SetJson ¶ added in v1.0.0
func SetJson(key string, obj interface{}, opt ...OptionFunc) error
SetJson 将obj通过 json.Marshal 转成json字符串,并设置到key上。 支持 SetExpireOpt SetKeepLastExpireOpt SetNoOverWriteOpt SetGetIsOverwriteOpt SetGetPreviousValueStringOpt SetGetPreviousValueInt64Opt SetGetPreviousValueJsonObjectOpt
func VersionKey ¶ added in v0.1.4
func VersionKey(keys ...interface{}) string
func WeiboMarkMblogIdKey ¶ added in v1.0.0
func WeiboMarkMblogIdKey(keys ...interface{}) string
func WeiboNewsInfoKey ¶ added in v1.0.0
func WeiboNewsInfoKey(keys ...interface{}) string
func WeiboUserInfoKey ¶ added in v1.0.0
func WeiboUserInfoKey(keys ...interface{}) string
func YoutubeFreshKey ¶
func YoutubeFreshKey(keys ...interface{}) string
func YoutubeGroupAtAllMarkKey ¶ added in v0.0.10
func YoutubeGroupAtAllMarkKey(keys ...interface{}) string
func YoutubeGroupConcernConfigKey ¶ added in v0.0.10
func YoutubeGroupConcernConfigKey(keys ...interface{}) string
func YoutubeGroupConcernStateKey ¶
func YoutubeGroupConcernStateKey(keys ...interface{}) string
func YoutubeInfoKey ¶
func YoutubeInfoKey(keys ...interface{}) string
func YoutubeUserInfoKey ¶
func YoutubeUserInfoKey(keys ...interface{}) string
func YoutubeVideoKey ¶
func YoutubeVideoKey(keys ...interface{}) string
Types ¶
type KeyPatternFunc ¶ added in v0.1.0
type KeyPatternFunc func(...interface{}) string
type OptionFunc ¶ added in v1.0.0
type OptionFunc func(o *option)
func GetIgnoreExpireOpt ¶ added in v1.0.0
func GetIgnoreExpireOpt() OptionFunc
GetIgnoreExpireOpt Get配置,忽略key的过期时间,如果key曾经设置过但已经过期,依然可以获取到
func IgnoreNotFoundOpt ¶ added in v1.0.0
func IgnoreNotFoundOpt() OptionFunc
IgnoreNotFoundOpt 获取值时不返回 buntdb.ErrNotFound ,而是返回nil
func SetExpireOpt ¶ added in v1.0.0
func SetExpireOpt(expire time.Duration) OptionFunc
SetExpireOpt 设置set时的过期时间 该设置与 SetKeepLastExpireOpt 同时设置时,本设置会生效
func SetGetIsOverwriteOpt ¶ added in v1.0.0
func SetGetIsOverwriteOpt(isOverWrite *bool) OptionFunc
SetGetIsOverwriteOpt Set配置,获取此次set是否将覆盖一个旧值,可以与 SetNoOverWriteOpt 同时设置
func SetGetPreviousValueInt64Opt ¶ added in v1.0.0
func SetGetPreviousValueInt64Opt(previous *int64) OptionFunc
SetGetPreviousValueInt64Opt Set配置,将key的上一个值解析到int64并放到previous中
func SetGetPreviousValueJsonObjectOpt ¶ added in v1.0.0
func SetGetPreviousValueJsonObjectOpt(previous interface{}) OptionFunc
SetGetPreviousValueJsonObjectOpt Set配置,将key的上一个值用json解析并放到previous中
func SetGetPreviousValueStringOpt ¶ added in v1.0.0
func SetGetPreviousValueStringOpt(previous *string) OptionFunc
SetGetPreviousValueStringOpt Set配置,存储key上一个值到previous中
func SetKeepLastExpireOpt ¶ added in v1.0.0
func SetKeepLastExpireOpt() OptionFunc
SetKeepLastExpireOpt 设置set时保留上次的过期时间 该设置与 SetKeepLastExpireOpt 同时设置时, SetExpireOpt 设置会生效
func SetNoOverWriteOpt ¶ added in v1.0.0
func SetNoOverWriteOpt() OptionFunc
SetNoOverWriteOpt Set配置,当key已经存在时不进行覆盖,而是返回 ErrRollback
type ShortCut ¶
type ShortCut struct{}
ShortCut 包含了许多数据库的读写helper,只需嵌入即可使用,如果不想嵌入,也可以通过包名调用
func (*ShortCut) CreatePatternIndex ¶ added in v0.1.4
func (s *ShortCut) CreatePatternIndex(patternFunc KeyPatternFunc, suffix []interface{}, less ...func(a, b string) bool) error
func (*ShortCut) Delete ¶ added in v1.0.0
func (s *ShortCut) Delete(key string, opt ...OptionFunc) (string, error)
Delete 删除key,并返回key上的值 支持 IgnoreNotFoundOpt
func (*ShortCut) DeleteInt64 ¶ added in v1.0.0
func (s *ShortCut) DeleteInt64(key string, opt ...OptionFunc) (int64, error)
DeleteInt64 删除key,解析key上的值到int64并返回 支持 IgnoreNotFoundOpt
func (*ShortCut) Exist ¶ added in v1.0.0
func (s *ShortCut) Exist(key string, opt ...OptionFunc) bool
Exist 查询key是否存在,key不存在或者发生任何错误时返回 false 支持 GetTTLOpt GetIgnoreExpireOpt
func (*ShortCut) Get ¶ added in v1.0.0
func (s *ShortCut) Get(key string, opt ...OptionFunc) (string, error)
Get 通过key获取value 支持 GetIgnoreExpireOpt IgnoreNotFoundOpt GetTTLOpt
func (*ShortCut) GetInt64 ¶ added in v0.1.4
func (s *ShortCut) GetInt64(key string, opt ...OptionFunc) (int64, error)
GetInt64 通过key获取value,并将value解析成int64 支持 GetIgnoreExpireOpt IgnoreNotFoundOpt GetTTLOpt 当设置了 IgnoreNotFoundOpt 时,key不存在时会直接返回0,不会返回错误
func (*ShortCut) GetJson ¶ added in v1.0.0
func (s *ShortCut) GetJson(key string, obj interface{}, opt ...OptionFunc) error
GetJson 获取key对应的value,并通过 json.Unmarshal 到obj上 支持 GetIgnoreExpireOpt IgnoreNotFoundOpt GetTTLOpt
func (*ShortCut) IncInt64 ¶ added in v1.0.0
IncInt64 将key上的int64值加上 value 并保存,返回保存后的值。 如果key不存在,则会默认其为0,返回值为1 如果key上的value不是一个int64,则会返回错误
func (*ShortCut) RCover ¶ added in v0.0.18
RCover 在一个只读事务中执行f,不同的是它不获取 buntdb.Tx ,而由 f 自己控制。 所有写操作会失败,或者回滚。
func (*ShortCut) RWCover ¶ added in v0.1.0
RWCover 在一个可读可写事务中执行f,不同的是它不获取 buntdb.Tx ,而由 f 自己控制。 需要注意可写事务是唯一的,同一时间只会存在一个可写事务,所有耗时操作禁止放在可写事务中执行 在同一Goroutine中,可写事务可以嵌套
func (*ShortCut) RWCoverTx ¶ added in v0.0.18
RWCoverTx 在一个可读可写事务中执行f,注意f的返回值不一定是RWCoverTx的返回值 有可能f返回nil,但RWTxCover返回non-nil 可以忽略error,但不要简单地用f返回值替代RWTxCover返回值,ref: bilibili/MarkDynamicId 需要注意可写事务是唯一的,同一时间只会存在一个可写事务,所有耗时操作禁止放在可写事务中执行 在同一Goroutine中,可写事务可以嵌套
func (*ShortCut) SeqNext ¶ added in v0.1.2
SeqNext 将key上的int64值加上1并保存,返回保存后的值。 如果key不存在,则会默认其为0,返回值为1 等价于 s.IncInt64(key, 1)
func (*ShortCut) Set ¶ added in v1.0.0
func (s *ShortCut) Set(key, value string, opt ...OptionFunc) error
Set 通过key设置value 支持 SetExpireOpt SetKeepLastExpireOpt SetNoOverWriteOpt SetGetIsOverwriteOpt SetGetPreviousValueStringOpt SetGetPreviousValueInt64Opt SetGetPreviousValueJsonObjectOpt
func (*ShortCut) SetInt64 ¶ added in v0.1.4
func (s *ShortCut) SetInt64(key string, value int64, opt ...OptionFunc) error
SetInt64 通过key设置int64格式的value 支持 SetExpireOpt SetKeepLastExpireOpt SetNoOverWriteOpt SetGetIsOverwriteOpt SetGetPreviousValueStringOpt SetGetPreviousValueInt64Opt SetGetPreviousValueJsonObjectOpt
func (*ShortCut) SetJson ¶ added in v1.0.0
func (s *ShortCut) SetJson(key string, obj interface{}, opt ...OptionFunc) error
SetJson 将obj通过 json.Marshal 转成json字符串,并设置到key上。 支持 SetExpireOpt SetKeepLastExpireOpt SetNoOverWriteOpt SetGetIsOverwriteOpt SetGetPreviousValueStringOpt SetGetPreviousValueInt64Opt SetGetPreviousValueJsonObjectOpt