cache

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache provides file-based caching for provider results.

func New

func New(fs FileSystem, dir string, ttl time.Duration) (*Cache, error)

New creates a cache with an injected FileSystem, directory, and TTL.

func (*Cache) Age added in v0.3.2

func (c *Cache) Age(_ context.Context, id string) (time.Duration, bool)

Age returns how old the cached entry is, or false if not present.

func (*Cache) Get

func (c *Cache) Get(_ context.Context, id string) ([]quota.Result, bool, error)

Get returns cached results if present and not expired.

func (*Cache) Put

func (c *Cache) Put(_ context.Context, id string, results []quota.Result) error

Put writes results to cache atomically.

type FileSystem

type FileSystem = fsutil.FileSystem

Re-export for backward compatibility with existing callers.

type OSFileSystem

type OSFileSystem = fsutil.OSFileSystem

OSFileSystem delegates to the real OS.

Jump to

Keyboard shortcuts

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