Documentation
¶
Index ¶
- Variables
- type Client
- func (cli *Client) Add(ctx context.Context, key, val string) (err error)
- func (cli *Client) Get(ctx context.Context, key string, opts ...GetOption) (rev int64, val string, err error)
- func (cli *Client) List(ctx context.Context, key string) (_ []*Mail, err error)
- func (cli *Client) Pull(ctx context.Context, key string, ids ...int64) (pulled []int64, err error)
- func (cli *Client) Push(ctx context.Context, key, val string, opts ...PushOption) (id int64, err error)
- func (cli *Client) Set(ctx context.Context, key, val string) (rev int64, err error)
- func (cli *Client) Sync(ctx context.Context)
- type GetOption
- type KeyMappingFunc
- type Mail
- type OnSyncFailFunc
- type OnSyncIdleFunc
- type OnSyncSaveFunc
- type Option
- type PushOption
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v0.1.4
type Client struct {
// contains filtered or unexported fields
}
客户端
func (*Client) Get ¶ added in v0.1.4
func (cli *Client) Get(ctx context.Context, key string, opts ...GetOption) (rev int64, val string, err error)
获取数据,如果指定数据不在缓存里会自动从DB加载
func (*Client) Push ¶ added in v0.1.8
func (cli *Client) Push(ctx context.Context, key, val string, opts ...PushOption) (id int64, err error)
添加邮件,如果指定数据不在缓存里会自动从DB加载
type GetOption ¶ added in v0.1.4
type GetOption interface {
// contains filtered or unexported methods
}
Client.Get Options
func AddIfNotExists ¶ added in v0.1.8
type KeyMappingFunc ¶ added in v0.1.8
Redis(key) -> Mongo(db,collection,_id)
type Mail ¶ added in v0.1.4
type Mail struct { // auto-generated seq to identify a mail Id int64 `msgpack:"id"` // mail payload Val string `msgpack:"val"` }
邮件
func (Mail) GetImportance ¶ added in v0.1.9
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Client Options
func OnSyncFail ¶ added in v0.1.8
func OnSyncFail(f OnSyncFailFunc) Option
func OnSyncIdle ¶ added in v0.1.4
func OnSyncIdle(f OnSyncIdleFunc) Option
func OnSyncSave ¶ added in v0.1.4
func OnSyncSave(f OnSyncSaveFunc) Option
func WithKeyMap ¶ added in v0.1.4
func WithKeyMap(f KeyMappingFunc) Option
type PushOption ¶
type PushOption interface {
// contains filtered or unexported methods
}
Client.Push Options
func WithCapacity ¶
func WithCapacity(v uint16) PushOption
func WithImportance ¶ added in v0.1.8
func WithImportance(v uint8) PushOption
func WithRing ¶ added in v0.1.8
func WithRing() PushOption
Click to show internal directories.
Click to hide internal directories.