cache

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cache defines the content-hash finding cache (PRD section 15, optimization 2). Each file (and optionally each function) is hashed; if the hash is unchanged since the last run, its findings are reused instead of recomputed, so a recurring full scan costs about the same as an incremental.

Cache hashes file content with SHA-256 and stores the findings for each hash as a JSON file under its directory, so unchanged files reuse their findings instead of being recomputed.

Status: INERT. Built and tested, but not yet wired to any consumer. The MCP orchestrator will use it in Fase 1; kept in the core per PRD section 15.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	Dir string
}

Cache stores findings keyed by a file's content hash under Dir (default .codefit/cache). A cache hit means the file content is unchanged, so its findings can be reused instead of recomputed (PRD §15, optimization 2).

func (*Cache) Get

func (c *Cache) Get(fileHash string) ([]findings.Finding, bool)

Get returns the cached findings for a content hash and whether they were present. A missing or unreadable entry is treated as a miss.

func (*Cache) HashFile

func (c *Cache) HashFile(path string) (string, error)

HashFile returns the hex-encoded SHA-256 of a file's content.

func (*Cache) Set

func (c *Cache) Set(fileHash string, fs []findings.Finding) error

Set stores the findings computed for a content hash as a JSON file.

Jump to

Keyboard shortcuts

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