Versions in this module Expand all Collapse all v0 v0.1.0 Aug 23, 2022 Changes in this version + var ErrNotFound = errors.New("entcache: entry was not found") + func Evict(ctx context.Context) context.Context + func NewContext(ctx context.Context, levels ...AddGetDeleter) context.Context + func Skip(ctx context.Context) context.Context + func WithKey(ctx context.Context, key Key) context.Context + func WithTTL(ctx context.Context, ttl time.Duration) context.Context + type AddGetDeleter interface + Add func(context.Context, Key, *Entry, time.Duration) error + Del func(context.Context, Key) error + Get func(context.Context, Key) (*Entry, error) + func FromContext(ctx context.Context) (AddGetDeleter, bool) + type Driver struct + func NewDriver(drv dialect.Driver, opts ...Option) *Driver + func (d *Driver) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error) + func (d *Driver) Query(ctx context.Context, query string, args, v any) error + func (d *Driver) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error) + func (d *Driver) Stats() Stats + type Entry struct + Columns []string + Values [][]driver.Value + func (e *Entry) UnmarshalBinary(buf []byte) error + func (e Entry) MarshalBinary() ([]byte, error) + type Key any + func DefaultHash(query string, args []any) (Key, error) + type LRU struct + func NewLRU(maxEntries int) *LRU + func (l *LRU) Add(_ context.Context, k Key, e *Entry, ttl time.Duration) error + func (l *LRU) Del(_ context.Context, k Key) error + func (l *LRU) Get(_ context.Context, k Key) (*Entry, error) + type Option func(*Options) + func ContextLevel() Option + func Hash(hash func(query string, args []any) (Key, error)) Option + func Levels(levels ...AddGetDeleter) Option + func TTL(ttl time.Duration) Option + type Options struct + Cache AddGetDeleter + Hash func(query string, args []any) (Key, error) + Log func(...any) + TTL time.Duration + type Redis struct + func NewRedis(c redis.Cmdable) *Redis + func (r *Redis) Add(ctx context.Context, k Key, e *Entry, ttl time.Duration) error + func (r *Redis) Del(ctx context.Context, k Key) error + func (r *Redis) Get(ctx context.Context, k Key) (*Entry, error) + type Stats struct + Errors uint64 + Gets uint64 + Hits uint64