Help us shape the future of Go! Take the 2026 Go Developer Survey

authcache

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package authcache provides the legacy authorization cache adapter.

Deprecated: use github.com/faustbrian/go-authorization/v3/adapters/cache. This package remains supported for the longer of 180 days after successor public availability and two subsequently published stable root-module minor releases.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrManifestTooLarge preserves the direct adapter error identity for errors.Is.
	ErrManifestTooLarge = adapter.ErrManifestTooLarge
	// ErrInvalidRevision preserves the direct adapter error identity for errors.Is.
	ErrInvalidRevision = adapter.ErrInvalidRevision
	// ErrNilRepository preserves the direct adapter error identity for errors.Is.
	ErrNilRepository = adapter.ErrNilRepository
)

Functions

func New

New delegates to adapters/cache and retains its advisory, borrowed lifecycle.

func RepositoryLoader

func RepositoryLoader(
	repository policy.Repository,
) (cache.Loader[authorization.Revision, policy.Manifest], error)

RepositoryLoader delegates fresh exact-revision reads, not cache-hit verification; direct calls retain raw repository error/callback semantics.

Types

type Config

type Config struct {
	// Namespace separates application policy cache keys; callers own scope/uniqueness.
	Namespace string
	// Backend is borrowed; callers own its capacity, transport and shutdown policy.
	Backend cache.Backend
	// TTL is delegated cache expiration policy, not repository verification freshness.
	TTL cache.TTLPolicy
	// Clock is borrowed time policy and must be prompt/concurrency-safe; no lifecycle is owned.
	Clock cache.Clock
	// Observer is delegated borrowed cache observation; no ownership transfer occurs.
	Observer cache.Observer
	// MaxValue caps encoded cache bytes; zero selects 1 MiB.
	MaxValue int
	// MaxBatch is delegated to the cache multi-key admission policy.
	MaxBatch int
	// MaxKeySize is delegated key admission; zero selects 256.
	MaxKeySize int
}

Config retains released composition fields; collaborators stay caller-owned.

type ManifestCodec

type ManifestCodec struct {
	// MaxEncodedSize caps admitted encoding; non-positive values select 1 MiB.
	MaxEncodedSize int
}

ManifestCodec retains the released named codec and delegates size/profile policy.

func (ManifestCodec) Decode

func (codec ManifestCodec) Decode(encoded []byte) (policy.Manifest, error)

Decode delegates byte admission and application-profile validation.

func (ManifestCodec) Encode

func (codec ManifestCodec) Encode(manifest policy.Manifest) ([]byte, error)

Encode delegates validated serialization with post-allocation size rejection.

type RevisionKeyEncoder

type RevisionKeyEncoder struct{}

RevisionKeyEncoder retains the released nonzero decimal revision-key contract.

func (RevisionKeyEncoder) EncodeKey

func (RevisionKeyEncoder) EncodeKey(revision authorization.Revision) ([]byte, error)

EncodeKey delegates exact nonzero decimal key encoding.

Jump to

Keyboard shortcuts

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