Version: v0.0.0-...-4bdd3a7 Latest Latest

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

Go to latest
Published: Mar 27, 2021 License: MIT Imports: 6 Imported by: 0



Package _test provides utilities for imageserver/cache.Cache testing.



View Source
const (
	// KeyValid is a valid Cache key (with content)
	KeyValid = "test"
	// KeyMiss is an invalid Cache key (without content)
	KeyMiss = "unknown"


This section is empty.


func BenchmarkGet

func BenchmarkGet(b *testing.B, cache imageserver_cache.Cache, parallelism int, im *imageserver.Image)

BenchmarkGet is a helper to benchmark imageserver/cache.Cache.Get().

func TestGetMiss

func TestGetMiss(t *testing.T, cache imageserver_cache.Cache)

TestGetMiss is a helper to test imageserver/cache.Cache.Get() with a "cache miss".

func TestGetSet

func TestGetSet(t *testing.T, cache imageserver_cache.Cache)

TestGetSet is a helper to test imageserver/cache.Cache.Get()/Set().


type MapCache

type MapCache struct {
	// contains filtered or unexported fields

MapCache is a simple imageserver/cache.Cache implementation (it wraps a map) for tests.

func NewMapCache

func NewMapCache() *MapCache

NewMapCache creates a new CacheMap.

func (*MapCache) Get

func (cache *MapCache) Get(key string, params imageserver.Params) (*imageserver.Image, error)

Get implements imageserver/cache.Cache.

func (*MapCache) Set

func (cache *MapCache) Set(key string, im *imageserver.Image, params imageserver.Params) error

Set implements imageserver/cache.Cache.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL