cache

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

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