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 ¶
type Client struct {
// contains filtered or unexported fields
}
客户端
func (*Client) Get ¶
func (cli *Client) Get(ctx context.Context, key string, opts ...GetOption) (rev int64, val string, err error)
获取数据,如果指定数据不在缓存里会自动从DB加载
func (*Client) Push ¶
func (cli *Client) Push(ctx context.Context, key, val string, opts ...PushOption) (id int64, err error)
添加邮件,如果指定数据不在缓存里会自动从DB加载
type GetOption ¶
type GetOption interface {
// contains filtered or unexported methods
}
Client.Get Options
func AddIfNotExists ¶
type KeyMappingFunc ¶
Redis(key) -> Mongo(db,collection,_id)
type Mail ¶
type Mail struct { // auto-generated seq to identify a mail Id int64 `msgpack:"id"` // mail payload Val string `msgpack:"val"` }
邮件
func (Mail) GetImportance ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Client Options
func OnSyncFail ¶
func OnSyncFail(f OnSyncFailFunc) Option
func OnSyncIdle ¶
func OnSyncIdle(f OnSyncIdleFunc) Option
func OnSyncSave ¶
func OnSyncSave(f OnSyncSaveFunc) Option
func WithKeyMap ¶
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 ¶
func WithImportance(v uint8) PushOption
func WithRing ¶
func WithRing() PushOption
Click to show internal directories.
Click to hide internal directories.