Documentation
¶
Index ¶
- Variables
- func NewRedisClient(opts *redis.Options, logger *zap.Logger) *redis.Client
- type Cache
- type CacheConfig
- type CacheProvider
- type CacheRam
- type CacheWithTTL
- type CachedList
- type CachedListRedis
- type DisabledCache
- type Hash
- type RedisConfig
- type RedisHashService
- func (rs *RedisHashService) Existed(ctx context.Context, key string) (bool, error)
- func (rs *RedisHashService) GetValues(ctx context.Context, key string, fields ...string) ([]any, error)
- func (rs *RedisHashService) SetTTL(ctx context.Context, key string, ttl time.Duration)
- func (rs *RedisHashService) SetValues(ctx context.Context, key string, values map[string]any) error
- type RedisProvider
- type WithKey
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultLocalCacheItems = 0 //local cache items. it's important for performance & if redis failed.
View Source
var DefaultTimeout time.Duration = 30 * time.Minute
Functions ¶
func NewRedisClient ¶ added in v0.9.0
Types ¶
type CacheConfig ¶ added in v0.10.6
type CacheProvider ¶ added in v0.8.2
type CacheProvider[T any] interface { Set(key string, value T) Get(key string) (T, bool) Del(key string) error Keys() []string }
func NewCacheProvider ¶ added in v0.8.2
func NewCacheProvider[T any](t time.Duration) CacheProvider[T]
type CacheRam ¶ added in v0.8.2
type CacheRam[T any] struct { // contains filtered or unexported fields }
func NewRAMCacheProvider ¶ added in v0.10.0
type CacheWithTTL ¶ added in v0.10.4
type CachedList ¶ added in v0.9.1
type CachedList[T any] interface { Append(ctx context.Context, key string, raw ...T) error GetAll(ctx context.Context, key string) ([]T, error) Del(ctx context.Context, key string) error }
func NewCachedList ¶ added in v0.9.1
func NewCachedList[T any](prefix string, dur time.Duration) CachedList[T]
type CachedListRedis ¶ added in v0.9.1
type CachedListRedis[T any] struct { Logger *zap.Logger Client *redis.Client Prefix string Timeout time.Duration }
func (*CachedListRedis[T]) Append ¶ added in v0.9.1
func (ll *CachedListRedis[T]) Append(ctx context.Context, key string, raw ...T) error
type DisabledCache ¶ added in v0.10.6
type DisabledCache[T any] struct { // contains filtered or unexported fields }
func (*DisabledCache[T]) Del ¶ added in v0.10.6
func (dd *DisabledCache[T]) Del(key string) error
func (*DisabledCache[T]) Get ¶ added in v0.10.6
func (dd *DisabledCache[T]) Get(key string) (T, bool)
func (*DisabledCache[T]) Keys ¶ added in v0.10.6
func (dd *DisabledCache[T]) Keys() []string
func (*DisabledCache[T]) Set ¶ added in v0.10.6
func (dd *DisabledCache[T]) Set(key string, value T)
type Hash ¶ added in v0.10.3
type Hash interface { Existed(ctx context.Context, key string) (bool, error) SetTTL(ctx context.Context, key string, ttl time.Duration) GetValues(ctx context.Context, key string, fields ...string) ([]any, error) SetValues(ctx context.Context, key string, values map[string]any) error }
func NewRedisHashService ¶ added in v0.10.2
type RedisConfig ¶ added in v0.9.0
type RedisHashService ¶ added in v0.10.2
type RedisProvider ¶ added in v0.9.0
type RedisProvider[T any] struct { Client *redis.Client // contains filtered or unexported fields }
func (*RedisProvider[T]) Del ¶ added in v0.10.5
func (r *RedisProvider[T]) Del(key string) error
func (*RedisProvider[T]) Get ¶ added in v0.9.0
func (r *RedisProvider[T]) Get(key string) (T, bool)
Get implements CacheProvider.
func (*RedisProvider[T]) Keys ¶ added in v0.10.4
func (r *RedisProvider[T]) Keys() []string
func (*RedisProvider[T]) Set ¶ added in v0.9.0
func (r *RedisProvider[T]) Set(key string, value T)
Set implements CacheProvider.
Click to show internal directories.
Click to hide internal directories.