cache

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package cache persists per-file extraction results so `graphify update` can rebuild the graph after re-parsing only the files that changed. The expensive step is the tree-sitter parse; resolving and assembling the whole graph from cached per-file results is cheap, so caching the results (not just hashes) lets an incremental rebuild produce output byte-identical to a full build.

Index

Constants

View Source
const FileName = ".graphify_cache.json"

FileName is the cache file written under graphify-out alongside graph.json.

Variables

This section is empty.

Functions

func HashBytes

func HashBytes(b []byte) string

HashBytes returns the hex SHA-256 of b.

func Save

func Save(path string, c Cache) error

Save writes the cache as compact JSON.

Types

type Cache

type Cache map[string]Entry

Cache maps a slash-relative file path to its cached entry.

func Load

func Load(path string) Cache

Load reads a cache file. A missing or unreadable file returns an empty cache and no error, so callers can treat "no cache yet" as "re-parse everything".

type Entry

type Entry struct {
	Hash   string         `json:"hash"`
	Result extract.Result `json:"result"`
}

Entry is one file's content hash and its cached extraction result.

Jump to

Keyboard shortcuts

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