cache

package
v1.7.0 Latest Latest
Warning

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

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

Documentation

Overview

Package cache provides caching implementations for Warden check results.

Memory is a thin wrapper around the root package's warden.MemoryCache: the sharded LRU actually lives in package warden (cache_memory.go) because the engine must be able to construct it directly from Config.CacheTTL/CacheMaxSize without an import cycle (this package imports warden, so warden cannot import it back). This wrapper exists only so existing `cache.NewMemory(...)` call sites keep compiling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Memory

type Memory = warden.MemoryCache

Memory is warden's built-in memory cache, re-exported from this subpackage for backward compatibility. New code should prefer warden.NewMemoryCache directly.

func NewMemory

func NewMemory(opts ...MemoryOption) *Memory

NewMemory creates a new in-memory cache backed by warden.NewMemoryCache.

type MemoryOption

type MemoryOption = warden.MemoryCacheOption

MemoryOption configures a Memory cache.

func WithMaxSize

func WithMaxSize(n int) MemoryOption

WithMaxSize sets the maximum number of cache entries.

func WithTTL

func WithTTL(ttl time.Duration) MemoryOption

WithTTL sets the cache entry time-to-live.

Jump to

Keyboard shortcuts

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