Documentation
¶
Index ¶
- func IsNotFound(err error) bool
- func NormalizeErr(err error) error
- func SetRedisSessionResolver(fn func() RedisSession)
- type C
- type Options
- type RedisContext
- func (r *RedisContext) Del(ctx context.Context, keys ...string) error
- func (r *RedisContext) Exists(ctx context.Context, key string) (bool, error)
- func (r *RedisContext) Get(ctx context.Context, key string) (string, error)
- func (r *RedisContext) Publish(ctx context.Context, channel string, message any) error
- func (r *RedisContext) Set(ctx context.Context, key string, value any, ttl time.Duration) error
- type RedisOptions
- type RedisSession
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsNotFound ¶ added in v1.22.7
IsNotFound reports whether err is a missing-key error from cache/redis session.
func NormalizeErr ¶ added in v1.22.7
NormalizeErr maps redis driver errors to cache-level errors.
func SetRedisSessionResolver ¶ added in v1.22.7
func SetRedisSessionResolver(fn func() RedisSession)
SetRedisSessionResolver installs the global session resolver (used by factory).
Types ¶
type C ¶
type C interface {
Get(key string, value interface{}) (err error)
GetSkipLocal(key string, value interface{}) (err error)
GetProxy() *cache.Cache
Exists(key string) bool
Set(key string, value interface{}) (err error)
SetTTL(key string, value interface{}, ttl time.Duration) (err error)
Del(key string) error
}
type RedisContext ¶ added in v1.22.7
type RedisContext struct {
// contains filtered or unexported fields
}
RedisContext is the facade for RedisSession, similar to persistence.OrmContext.
func NewRedis ¶ added in v1.22.7
func NewRedis() *RedisContext
func WrapRedisSession ¶ added in v1.22.7
func WrapRedisSession(s RedisSession) *RedisContext
func (*RedisContext) Del ¶ added in v1.22.7
func (r *RedisContext) Del(ctx context.Context, keys ...string) error
type RedisOptions ¶
type RedisSession ¶ added in v1.22.7
type RedisSession interface {
Get(ctx context.Context, key string) (string, error)
Set(ctx context.Context, key string, value any, ttl time.Duration) error
Del(ctx context.Context, keys ...string) error
Exists(ctx context.Context, key string) (bool, error)
Publish(ctx context.Context, channel string, message any) error
}
RedisSession is the low-level Redis command surface (KV, pub/sub).
func NewRedisSession ¶ added in v1.22.7
func NewRedisSession(c *redis.Client) RedisSession
NewRedisSession wraps a go-redis client; client stays inside cache package.
Click to show internal directories.
Click to hide internal directories.