cache

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeHash

func ComputeHash(path string) (string, error)

ComputeHash calculates the SHA-256 hash of a file

Types

type Entry

type Entry struct {
	Hash     string          `json:"hash"`
	Findings json.RawMessage `json:"findings"`
}

Entry represents a cached scan result for a single file

type Store

type Store struct {
	Entries map[string]Entry `json:"entries"`
	IsDirty bool             `json:"-"`
	// contains filtered or unexported fields
}

Store manages the persistent cache

func NewStore

func NewStore(dir string) (*Store, error)

NewStore creates a new cache store

func (*Store) Get

func (s *Store) Get(path string, currentHash string) (json.RawMessage, bool)

Get returns the cached findings if the hash matches

func (*Store) Save

func (s *Store) Save() error

Save writes the cache to disk

func (*Store) Set

func (s *Store) Set(path string, hash string, findings interface{})

Set updates the cache for a file

Jump to

Keyboard shortcuts

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