cache

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterCache

func RegisterCache(reg CacheRegistration)

init() is serialized by Go, but the mutex covers consumers that register concurrently

func RegisteredCacheNames

func RegisteredCacheNames() []string

Types

type Cache

type Cache interface {
	Lookup(ctx context.Context, t pkg.TileRequest) (*pkg.Image, error)
	Save(ctx context.Context, t pkg.TileRequest, img *pkg.Image) error
	// Reports whether an entry was there. A miss isn't an error
	Remove(ctx context.Context, t pkg.TileRequest) (bool, error)
}

type CacheDeps added in v0.11.0

type CacheDeps struct {
	ErrorMessages config.ErrorMessages
	Datastores    datastore.DatastoreRegistry
}

New dependencies are added as fields so the Initialize signature stays stable

type CacheRegistration

type CacheRegistration interface {
	Name() string
	Initialize(config any, deps CacheDeps) (Cache, error)
	InitializeConfig() any
}

func RegisteredCache

func RegisteredCache(name string) (CacheRegistration, bool)

type CacheRegistry added in v0.12.0

type CacheRegistry interface {
	Get(id string) (Cache, bool)
	IDs() []string
}

Gives entities access to the caches configured by ID

type Decorator added in v0.13.0

type Decorator interface {
	Unwrap() Cache
}

Caches wrapping another without storing anything, so capability checks see through them

type Expiring added in v0.13.0

type Expiring interface {
	TTL() time.Duration
}

Caches that stop returning a tile once it reaches a maximum age

type Noop added in v0.13.0

type Noop interface {
	IsNoop() bool
}

Caches that never retain a tile

type Parent added in v0.13.0

type Parent interface {
	Children() []Cache
}

Caches that nest others. Children returns them in configuration order

type PerIdentity added in v0.13.0

type PerIdentity interface {
	KeyedByIdentity() bool
}

Caches whose entries vary by requester

Jump to

Keyboard shortcuts

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