Documentation ¶
Index ¶
- func InitCacheClientSvc(cacheHost string, cachePort string, cachePassword string)
- func InitCacheMemSvc()
- func NewRedisClient(hostname, port, password string) (*redis.Client, error)
- type Client
- func (cache *Client) Del(ctx context.Context, key string) error
- func (cache *Client) Expire(ctx context.Context, key string, expiration time.Duration) error
- func (cache *Client) Get(ctx context.Context, key string) (interface{}, error)
- func (cache *Client) HDel(ctx context.Context, key string, fields string) error
- func (cache *Client) HGet(ctx context.Context, key string, field string) (string, error)
- func (cache *Client) HGetAll(ctx context.Context, key string) map[string]string
- func (cache *Client) HSet(ctx context.Context, key string, values ...interface{}) error
- func (cache *Client) HSetExp(ctx context.Context, key string, expiration time.Duration, ...) error
- func (cache *Client) HSetNX(ctx context.Context, key string, field string, value interface{}, ...) (set bool, err error)
- func (cache *Client) Set(ctx context.Context, key string, values interface{}, expiration time.Duration) error
- type ClientMem
- func (cache *ClientMem) Del(ctx context.Context, key string) error
- func (cache *ClientMem) Expire(ctx context.Context, key string, expiration time.Duration) error
- func (cache *ClientMem) Get(ctx context.Context, key string) (interface{}, error)
- func (cache *ClientMem) HDel(ctx context.Context, key string, fields string) error
- func (cache *ClientMem) HGet(ctx context.Context, key string, field string) (string, error)
- func (cache *ClientMem) HGetAll(ctx context.Context, key string) map[string]string
- func (cache *ClientMem) HSet(ctx context.Context, key string, values ...interface{}) error
- func (cache *ClientMem) HSetExp(ctx context.Context, key string, expiration time.Duration, ...) error
- func (cache *ClientMem) HSetNX(ctx context.Context, key string, field string, value interface{}, ...) (set bool, err error)
- func (cache *ClientMem) Set(ctx context.Context, key string, values interface{}, expiration time.Duration) error
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitCacheClientSvc ¶
func InitCacheMemSvc ¶
func InitCacheMemSvc()
func NewRedisClient ¶
NewCacheClient return a new instance of cache client
Types ¶
type Client ¶
type Client struct {
Client *redis.Client
}
func NewSimpleCacheClient ¶
type ClientMem ¶
func NewCacheMemClient ¶
type Service ¶
type Service interface { HSet(ctx context.Context, key string, values ...interface{}) error Set(ctx context.Context, key string, values interface{}, expiration time.Duration) error HSetExp(ctx context.Context, key string, expiration time.Duration, values ...interface{}) error HSetNX(ctx context.Context, key string, field string, value interface{}, expiration time.Duration) (set bool, err error) Expire(ctx context.Context, key string, expiration time.Duration) error Get(ctx context.Context, key string) (interface{}, error) HGet(ctx context.Context, key string, field string) (string, error) HGetAll(ctx context.Context, key string) map[string]string HDel(ctx context.Context, key string, fields string) error Del(ctx context.Context, key string) error }
func GetCacheClient ¶
func GetCacheClient() Service
func GetCacheMemClient ¶
func GetCacheMemClient() Service
Click to show internal directories.
Click to hide internal directories.