Documentation ¶
Index ¶
- type SingleRedisProvider
- func (r SingleRedisProvider) BatchDelete(ctx context.Context, keys ...string) bool
- func (r SingleRedisProvider) Client() interface{}
- func (r SingleRedisProvider) Close()
- func (r SingleRedisProvider) Delete(ctx context.Context, key string) bool
- func (r SingleRedisProvider) Exists(ctx context.Context, key string) bool
- func (r SingleRedisProvider) HDelete(ctx context.Context, key string, fields ...string) bool
- func (r SingleRedisProvider) HExists(ctx context.Context, key, field string) bool
- func (r SingleRedisProvider) HGet(ctx context.Context, key, field string) string
- func (r SingleRedisProvider) HGetAll(ctx context.Context, key string) map[string]string
- func (r SingleRedisProvider) HSet(ctx context.Context, key, field, value string) bool
- func (r SingleRedisProvider) Incr(ctx context.Context, key string) bool
- func (r SingleRedisProvider) IncrByExpires(ctx context.Context, key string, value int64, expires time.Duration) bool
- func (r SingleRedisProvider) IncrExpires(ctx context.Context, key string, expires time.Duration) bool
- func (r SingleRedisProvider) LIndex(ctx context.Context, key string, index int64) string
- func (r SingleRedisProvider) LLen(ctx context.Context, key string) int64
- func (r SingleRedisProvider) LPop(ctx context.Context, key string) string
- func (r SingleRedisProvider) LPush(ctx context.Context, key string, value ...interface{}) bool
- func (r SingleRedisProvider) LRange(ctx context.Context, key string, start, stop int64) []string
- func (r *SingleRedisProvider) Operate(ctx context.Context, cmd interface{}) error
- func (r SingleRedisProvider) RPop(ctx context.Context, key string) string
- func (r SingleRedisProvider) RPush(ctx context.Context, key string, value ...interface{}) bool
- func (r SingleRedisProvider) SAdd(ctx context.Context, key string, members ...interface{}) bool
- func (r SingleRedisProvider) SCard(ctx context.Context, key string) int64
- func (r SingleRedisProvider) SMembers(ctx context.Context, key string) []string
- func (r SingleRedisProvider) Set(ctx context.Context, key, value string) bool
- func (r SingleRedisProvider) SetExpires(ctx context.Context, key, value string, expires time.Duration) bool
- func (r SingleRedisProvider) SetNX(ctx context.Context, key, value string, expires time.Duration) bool
- func (r SingleRedisProvider) String(ctx context.Context, key string) string
- func (r SingleRedisProvider) Val(ctx context.Context, script string, keys []string, args ...interface{}) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SingleRedisProvider ¶
type SingleRedisProvider struct {
// contains filtered or unexported fields
}
*
- SingleRedisProvider
- 基于Redis单实例的缓存实现(单机),配置中心或构造方法中参数的配置格式如下:
- <pre>
- {
- "host" : "缓存服务器主机地址,必须",
- "port" : "缓存服务器端口号",
- "sasl" : "是否开启安全认证,true|false,可选,默认是没有",
- "password" : "开启安全认证后的登录密码,sasl如果指定为true则必须"
- }
- </pre>
func (SingleRedisProvider) BatchDelete ¶
func (r SingleRedisProvider) BatchDelete(ctx context.Context, keys ...string) bool
BatchDelete 批量删除缓存中的key。
func (SingleRedisProvider) Client ¶ added in v1.0.9
func (r SingleRedisProvider) Client() interface{}
func (SingleRedisProvider) Delete ¶
func (r SingleRedisProvider) Delete(ctx context.Context, key string) bool
Delete 从缓存中删除指定key的缓存数据。
func (SingleRedisProvider) Exists ¶
func (r SingleRedisProvider) Exists(ctx context.Context, key string) bool
Exists 判断缓存中是否存在指定的key
func (SingleRedisProvider) HExists ¶
func (r SingleRedisProvider) HExists(ctx context.Context, key, field string) bool
HExists 判断缓存中指定key的map是否存在指定的字段,如果key或字段不存在则返回false。
func (SingleRedisProvider) HGet ¶
func (r SingleRedisProvider) HGet(ctx context.Context, key, field string) string
HGet 获取指定key的map数据某个字段的值,如果不存在则返回Null
func (SingleRedisProvider) HSet ¶
func (r SingleRedisProvider) HSet(ctx context.Context, key, field, value string) bool
HSet 将指定key的map数据的某个字段设置为给定的值。
func (SingleRedisProvider) Incr ¶ added in v1.0.4
func (r SingleRedisProvider) Incr(ctx context.Context, key string) bool
Incr 对指定的key结果集执行自增操作
func (SingleRedisProvider) IncrByExpires ¶ added in v1.0.5
func (SingleRedisProvider) IncrExpires ¶ added in v1.0.5
func (SingleRedisProvider) LLen ¶ added in v1.0.8
func (r SingleRedisProvider) LLen(ctx context.Context, key string) int64
func (SingleRedisProvider) LPop ¶ added in v1.0.8
func (r SingleRedisProvider) LPop(ctx context.Context, key string) string
func (SingleRedisProvider) LPush ¶ added in v1.0.8
func (r SingleRedisProvider) LPush(ctx context.Context, key string, value ...interface{}) bool
func (*SingleRedisProvider) Operate ¶
func (r *SingleRedisProvider) Operate(ctx context.Context, cmd interface{}) error
Operate 通过直接调用缓存客户端进行缓存操作,该操作适用于高级操作,如果执行失败会返回Null。
func (SingleRedisProvider) RPop ¶ added in v1.0.8
func (r SingleRedisProvider) RPop(ctx context.Context, key string) string
func (SingleRedisProvider) RPush ¶ added in v1.0.8
func (r SingleRedisProvider) RPush(ctx context.Context, key string, value ...interface{}) bool
func (SingleRedisProvider) SAdd ¶ added in v1.0.7
func (r SingleRedisProvider) SAdd(ctx context.Context, key string, members ...interface{}) bool
func (SingleRedisProvider) SCard ¶ added in v1.0.7
func (r SingleRedisProvider) SCard(ctx context.Context, key string) int64
func (SingleRedisProvider) SMembers ¶ added in v1.0.6
func (r SingleRedisProvider) SMembers(ctx context.Context, key string) []string
func (SingleRedisProvider) Set ¶
func (r SingleRedisProvider) Set(ctx context.Context, key, value string) bool
Set 使用指定的key将对象存入分布式缓存中,并使用缓存的默认过期设置,注意,存入的对象必须是可序列化的。
func (SingleRedisProvider) SetExpires ¶
func (r SingleRedisProvider) SetExpires(ctx context.Context, key, value string, expires time.Duration) bool
SetExpires 使用指定的key将对象存入分部式缓存中,并指定过期时间,注意,存入的对象必须是可序列化的
Click to show internal directories.
Click to hide internal directories.