Documentation
¶
Overview ¶
Package rueidiscache provides a Redis cache backend for entcache using Rueidis.
It implements both the entcache.Cache and entcache.StampedeLocker interfaces, providing distributed caching capabilities with robust Cache Stampede Protection and high-performance RESP3 Client-Side Caching.
When multiple concurrent requests attempt to fetch the same missing key, exactly one request acquires a lock and queries the database. The other requests wait seamlessly using client-side caching until the data is populated, preventing database overload.
Invalidations for entcache multi-level caching are distributed through the "entcache:invalidations" Pub/Sub channel.
Index ¶
- type Rueidis
- func (r *Rueidis) Add(ctx context.Context, k entcache.Key, e *entcache.Entry, ttl time.Duration) error
- func (r *Rueidis) Close() error
- func (r *Rueidis) Del(ctx context.Context, k entcache.Key) error
- func (r *Rueidis) Get(ctx context.Context, k entcache.Key) (*entcache.Entry, error)
- func (r *Rueidis) LockOrWait(ctx context.Context, k entcache.Key) (bool, func(context.Context) (*entcache.Entry, error), func(context.Context), ...)
- func (r *Rueidis) WatchInvalidations(ctx context.Context, onInvalidate func(key entcache.Key)) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Rueidis ¶
type Rueidis struct {
// contains filtered or unexported fields
}
Rueidis is a cache implementation that uses Rueidis.
func (*Rueidis) Add ¶
func (r *Rueidis) Add(ctx context.Context, k entcache.Key, e *entcache.Entry, ttl time.Duration) error
Add adds the entry to the cache and unblocks waiting callers.