listcache

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CacheVersion    = 1
	DefaultCacheDir = ".markata/cache"
	CacheFileName   = "list.json"
)

Variables

This section is empty.

Functions

func LoadOrRefresh

func LoadOrRefresh(ctx context.Context, m *lifecycle.Manager, opts Options) error

func SetOptions

func SetOptions(m *lifecycle.Manager, opts Options)

Types

type Cache

type Cache struct {
	Version      int                   `json:"version"`
	ConfigHash   string                `json:"config_hash"`
	GeneratedAt  time.Time             `json:"generated_at"`
	ContentDir   string                `json:"content_dir"`
	GlobPatterns []string              `json:"glob_patterns"`
	Files        map[string]FileInfo   `json:"files"`
	Posts        map[string]CachedPost `json:"posts"`
	Feeds        []CachedFeed          `json:"feeds"`
}

type CachedFeed

type CachedFeed struct {
	Name      string   `json:"name"`
	Title     string   `json:"title"`
	Path      string   `json:"path"`
	PostPaths []string `json:"post_paths"`
}

type CachedPost

type CachedPost struct {
	Path        string            `json:"path"`
	Content     string            `json:"content"`
	Slug        string            `json:"slug"`
	Href        string            `json:"href"`
	Title       *string           `json:"title,omitempty"`
	Date        *time.Time        `json:"date,omitempty"`
	Published   bool              `json:"published"`
	Draft       bool              `json:"draft"`
	Private     bool              `json:"private"`
	Skip        bool              `json:"skip"`
	Tags        []string          `json:"tags,omitempty"`
	Description *string           `json:"description,omitempty"`
	Template    string            `json:"template"`
	Templates   map[string]string `json:"templates,omitempty"`
	Authors     []string          `json:"authors,omitempty"`
	Author      *string           `json:"author,omitempty"`
	SecretKey   string            `json:"secret_key,omitempty"`
	Extra       map[string]any    `json:"extra,omitempty"`
	WordCount   int               `json:"word_count"`
	ReadingTime int               `json:"reading_time"`
	CharCount   int               `json:"char_count"`
}

type FileInfo

type FileInfo struct {
	ModTime int64 `json:"mod_time"`
	Size    int64 `json:"size"`
}

type Options

type Options struct {
	CacheDir   string
	ConfigHash string
}

func OptionsFromManager

func OptionsFromManager(m *lifecycle.Manager) (Options, bool)

Jump to

Keyboard shortcuts

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