cache

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultTTL = 5 * time.Minute

DefaultTTL is the default cache time-to-live

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 with TTL

func New

func New(cacheDir string, ttl time.Duration) (*Cache, error)

New creates a new cache instance

func (*Cache) Clear

func (c *Cache) Clear() error

Clear removes all cached entries

func (*Cache) Get

func (c *Cache) Get(key string, v interface{}) bool

Get retrieves a value from the cache if it exists and is not expired

func (*Cache) Set

func (c *Cache) Set(key string, v interface{}) error

Set stores a value in the cache

type CacheEntry

type CacheEntry struct {
	Data      json.RawMessage `json:"data"`
	CreatedAt time.Time       `json:"created_at"`
}

CacheEntry represents a cached item with metadata

Jump to

Keyboard shortcuts

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