cache

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package cache provides file-based template caching with TTL support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadTemplates

func LoadTemplates(path string, ttl time.Duration) ([]api.Template, error)

LoadTemplates reads the cache file and returns templates if fresh. Returns (nil, nil) when: file missing, JSON corrupt, or TTL expired. Only returns a non-nil error for unexpected read failures.

func SaveTemplates

func SaveTemplates(path string, templates []api.Template) error

SaveTemplates writes templates to the cache file atomically.

Types

type TemplateCache

type TemplateCache struct {
	Templates []api.Template `json:"templates"`
	FetchedAt time.Time      `json:"fetched_at"`
}

TemplateCache is the on-disk representation of cached templates.

Jump to

Keyboard shortcuts

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