cache

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package cache adapts explicitly named caches to native Bindly injection.

Index

Constants

View Source
const Kind = "cache"

Variables

This section is empty.

Functions

func NewMemory

func NewMemory(capacity int) (xcache.Cache, error)

NewMemory creates the built-in backend for explicit composition without exposing its internal implementation type to applications. Zero capacity means unlimited entries. Register it with New under an explicit name.

func Providers

func Providers(value xcache.Provider) []locator.Provider

Providers binds a supplied cache provider under kind=cache. Nil contributes no capability, so a required handler binding fails normally.

Types

type Registry

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

Registry borrows named caches supplied by its owner. It creates and closes none.

func New

func New(backends map[string]xcache.Cache) (*Registry, error)

New snapshots the explicit registration map. Empty names and nil backends are invalid, including typed nil implementations.

func (*Registry) Cache

func (r *Registry) Cache(ctx context.Context, name string) (xcache.Cache, error)

Cache returns only an exact registered name.

Jump to

Keyboard shortcuts

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