cache

package
v0.0.0-...-6224849 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const CompilerVersion = "0.1"

Variables

This section is empty.

Functions

func GraphHash

func GraphHash(graph *modules.ModuleGraph) (string, error)

GraphHash hashes the resolved import graph and source payloads.

func HashBytes

func HashBytes(data []byte) string

HashBytes returns a stable SHA-256 hex digest.

Types

type Key

type Key struct {
	Backend         string `json:"backend"`
	CompilerVersion string `json:"compiler_version"`
	StdlibVersion   string `json:"stdlib_version"`
	SourceHash      string `json:"source_hash"`
	GraphHash       string `json:"graph_hash"`
}

Key identifies a cacheable compilation artifact.

func NewKey

func NewKey(source []byte, graph *modules.ModuleGraph, backend string) (Key, error)

NewKey creates a deterministic cache key for a compiler artifact.

func (Key) String

func (k Key) String() string

type Store

type Store struct {
	Dir string
}

Store is a simple filesystem-backed cache store.

func NewStore

func NewStore(dir string) *Store

NewStore creates a cache store rooted at dir.

func (*Store) Get

func (s *Store) Get(key Key) ([]byte, bool, error)

Get returns a cached artifact payload when present.

func (*Store) Path

func (s *Store) Path(key Key) string

Path returns the on-disk path for a cache entry.

func (*Store) Put

func (s *Store) Put(key Key, payload []byte) error

Put stores a cache payload atomically.

func (*Store) PutJSON

func (s *Store) PutJSON(key Key, value any) error

PutJSON marshals a value and writes it into the cache.

Jump to

Keyboard shortcuts

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