cache

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package cache manages the local graph cache stored under ~/.supermodel/cache/. Graphs are keyed by the SHA-256 hash of the uploaded repository ZIP, matching the content-addressed scheme used by the Supermodel API.

This is a shared kernel package. It must contain no business logic. Slice packages under internal/ may import it freely.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnalysisKey added in v0.4.0

func AnalysisKey(fingerprint, analysisType string) string

AnalysisKey builds a cache key for a specific analysis type on a repo state.

func Evict

func Evict(hash string) error

Evict removes the cached entry for hash. No-ops on cache miss.

func Get

func Get(hash string) (*api.Graph, error)

Get loads a cached graph for hash. Returns (nil, nil) on cache miss.

func HashFile

func HashFile(path string) (string, error)

HashFile returns the hex-encoded SHA-256 of the file at path.

func Put

func Put(hash string, g *api.Graph) error

Put stores g in the cache under hash.

func RepoFingerprint added in v0.4.0

func RepoFingerprint(dir string) (string, error)

RepoFingerprint returns a fast, content-based cache key for the repo at dir.

For clean git repos (~1ms): returns the commit SHA. For dirty git repos (~100ms): returns commitSHA:dirtyHash. For non-git dirs: returns empty string and an error.

Types

This section is empty.

Jump to

Keyboard shortcuts

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