refresher

package
v1.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRefreshUpstreamBadStatusCode = errors.New("invalid upstream status code")

Functions

This section is empty.

Types

type Refresh

type Refresh struct {
	// contains filtered or unexported fields
}

Refresh is responsible for background refreshing of cache entries. It periodically samples random shards and randomly selects "cold" entries (from the end of each shard's InMemoryStorage list) to refreshItem if necessary. Communication: provider->consumer (MPSC).

func New

func New(ctx context.Context, cfg config.Config, storage lru.Storage, upstream upstream.Upstream) *Refresh

New constructs a Refresh.

func (*Refresh) Run

func (r *Refresh) Run()

Run starts the refresher background loop. It runs a logger (if debugging is enabled), spawns a provider for sampling shards, and continuously processes shard samples for candidate responses to refreshItem.

type Refresher

type Refresher interface {
	Run()
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL