cache

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

func Diff(cachedHashes, diskHashes map[string]string) (changed, deleted []string)

Diff computes which files changed or were deleted. diskHashes: file_path → hash for all files currently on disk Returns (changed, deleted) file paths.

Types

type Cache

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

Cache manages the SQLite build cache.

func Open

func Open(path string) (*Cache, error)

Open opens or creates the cache database at the given path.

func (*Cache) Close

func (c *Cache) Close() error

Close closes the database.

func (*Cache) Delete

func (c *Cache) Delete(filePath string) error

Delete removes a page record from the cache.

func (*Cache) DeleteMany

func (c *Cache) DeleteMany(filePaths []string) error

DeleteMany removes multiple page records.

func (*Cache) GetState

func (c *Cache) GetState(key string) (string, error)

GetState retrieves a build state value by key.

func (*Cache) LoadAll

func (c *Cache) LoadAll() ([]*PageRecord, error)

LoadAll returns all cached page records.

func (*Cache) LoadHashes

func (c *Cache) LoadHashes() (map[string]string, error)

LoadHashes returns a map of file_path → file_hash for all cached pages.

func (*Cache) Save

func (c *Cache) Save(r *PageRecord) error

Save upserts a page record into the cache.

func (*Cache) SetState

func (c *Cache) SetState(key, value string) error

SetState stores a build state value.

type PageRecord

type PageRecord struct {
	FilePath      string
	FileHash      string
	Permalink     string
	Title         string
	LinkTitle     string
	Description   string
	Tags          []string
	Date          time.Time
	Section       string
	Lang          string
	Depth         int
	WordCount     int
	ReadingTime   int
	Summary       string
	ContentPlain  string // plain text for search (stripped HTML)
	Params        map[string]any
	Weight        int
	NoIndex       bool
	ExcludeSearch bool
	Type          string
	Draft         bool
	Kind          string
	BuiltAt       int64
}

PageRecord is a row from page_cache.

Jump to

Keyboard shortcuts

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