cachetest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package cachetest is the conformance suite every cache.Cache backend runs: what a hit, a miss and an invalidation mean, independent of where the entries and versions live. A backend's own tests call Run with a factory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(t *testing.T, newCache func(t *testing.T) cache.Cache, opts Options)

Run runs the suite, each case on a fresh cache from newCache.

Types

type Options

type Options struct {
	// MaxValueBytes is the largest value the backend keeps; 0 skips the
	// oversize case.
	MaxValueBytes int

	// NewPair returns two instances over one shared store, as two processes
	// see it; nil skips the cross-instance cases.
	NewPair func(t *testing.T) (a, b cache.Cache)

	// Entries counts the entries a cache from the factory holds. No Lookup
	// reads the key a zero Snapshot would land under, so only a count shows
	// that one stored nothing; nil skips that case.
	Entries func(c cache.Cache) int
}

Options describes what a backend can do beyond the Cache contract.

Jump to

Keyboard shortcuts

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