Documentation ¶
Index ¶
- type Config
- type Option
- type Redisc
- func (cd *Redisc) Apply(cnf *conf.Configuration) (err error)
- func (cd *Redisc) CleanLocalCache()
- func (cd *Redisc) Del(ctx context.Context, key string) error
- func (cd *Redisc) DeleteFromLocalCache(key string)
- func (cd *Redisc) Get(ctx context.Context, key string, v any, opts ...cache.Option) error
- func (cd *Redisc) Group(ctx context.Context, key string, v any, opt *cache.Options) error
- func (cd *Redisc) Has(ctx context.Context, key string) bool
- func (cd *Redisc) IsNotFound(err error) bool
- func (cd *Redisc) LocalCacheEnabled() bool
- func (cd *Redisc) RedisClient() redis.Cmdable
- func (cd *Redisc) Register() error
- func (cd *Redisc) Set(ctx context.Context, key string, v any, opts ...cache.Option) error
- func (cd *Redisc) Stats() *cache.Stats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶ added in v0.1.0
type Option func(*Redisc)
func WithRedisClient ¶ added in v0.1.0
func WithRedisClient(cli redis.UniversalClient) Option
type Redisc ¶
type Redisc struct { Config // contains filtered or unexported fields }
Redisc is a cache implementation of redis.
if you want to register to cache manager, set a `driverName` in configuration
func New ¶
func New(cfg *conf.Configuration, opts ...Option) (*Redisc, error)
New creates a new redis cache with the provided configuration.
Cache Configuration:
driverName: redis # optional, default is redis addrs: # required db: 0 ... # other redis configuration local: # local cache,optional, default is nil size: 1000 # optional, default is 1000 samples: 100000 # optional, default is 100000 ttl: 1m # optional, default is 1m
If you want to register to cache manager, set a `driverName` in configuration.
func (*Redisc) Apply ¶
func (cd *Redisc) Apply(cnf *conf.Configuration) (err error)
Apply conf.configurable
func (*Redisc) CleanLocalCache ¶ added in v0.3.0
func (cd *Redisc) CleanLocalCache()
func (*Redisc) DeleteFromLocalCache ¶ added in v0.3.0
func (*Redisc) IsNotFound ¶
IsNotFound returns true if the error is cache.ErrCacheMiss.
func (*Redisc) LocalCacheEnabled ¶ added in v0.1.0
LocalCacheEnabled returns true if local cache is enabled.
func (*Redisc) RedisClient ¶
func (cd *Redisc) RedisClient() redis.Cmdable
RedisClient returns the underlying redis client.
Click to show internal directories.
Click to hide internal directories.