Documentation
¶
Overview ¶
Package cache coordinates callers of a borrowed xdatly byte cache. It owns no backend or cached values; its metadata is local to one owner.
Index ¶
- type Coordinator
- func (c *Coordinator) Count(ctx context.Context, backend xcache.Cache) (int, error)
- func (c *Coordinator) Invalidate(ctx context.Context, backend xcache.Cache, partition string, all bool) (int, error)
- func (c *Coordinator) Resolve(ctx context.Context, backend xcache.Cache, key, partition string, ...) ([]byte, bool, error)
- type Outcome
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Coordinator ¶
type Coordinator struct {
// contains filtered or unexported fields
}
Coordinator shares in-flight fetches and fences writes across local invalidations. Backend operations and value validation never hold mu.
func New ¶
func New(clock func() time.Time) *Coordinator
func (*Coordinator) Invalidate ¶
func (c *Coordinator) Invalidate(ctx context.Context, backend xcache.Cache, partition string, all bool) (int, error)
Invalidate changes the key generation before deleting old physical keys. Slow backend deletes cannot block unrelated requests or resurrect old data.
func (*Coordinator) Resolve ¶
func (c *Coordinator) Resolve(ctx context.Context, backend xcache.Cache, key, partition string, valid func([]byte) (time.Time, bool), fetch func(context.Context) (Outcome, error)) ([]byte, bool, error)
Resolve returns a live backend hit or shares one fetch for this generation. valid checks the caller's absolute-expiry envelope outside the mutex.
Click to show internal directories.
Click to hide internal directories.