cache

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlameAtCommitKey

func BlameAtCommitKey(repoPath, commitHash string, files []string, sampleSize int) string

BlameAtCommitKey returns the cache key for blame at a specific commit. Immutable: blame at a fixed commit never changes.

func BlameKey

func BlameKey(repoPath, headHash string, files []string, sampleSize int) string

BlameKey returns the cache key for ConcurrentBlameFiles results. Uses HEAD commit hash — invalidated when HEAD moves.

func CacheSize

func CacheSize() (int64, error)

CacheSize returns the total size of cache in bytes.

func Clear

func Clear(repoPath string) error

Clear removes cache for a specific repo, or all caches if repoPath is empty.

func DebtKey

func DebtKey(repoPath string, fixCommitHashes []string) string

DebtKey returns the cache key for CalcDebt results. Keyed by the fix commit hashes used.

func LogKey

func LogKey(repoPath, headHash string) string

LogKey returns the cache key for ParseLog results.

func MergeLogKey

func MergeLogKey(repoPath, headHash string) string

MergeLogKey returns the cache key for ParseMergeCommits results.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store manages disk-based caching of expensive git operations. Cache is stored in ~/.eis/cache/ keyed by repo path hash.

func New

func New(enabled bool) *Store

New creates a cache store. If enabled is false, all Get calls return miss.

func NewWithDir

func NewWithDir(enabled bool, baseDir string) *Store

NewWithDir creates a cache store with a custom base directory. If baseDir is empty, the default ~/.eis/cache is used.

func (*Store) Enabled

func (s *Store) Enabled() bool

Enabled returns whether the cache is active.

func (*Store) Get

func (s *Store) Get(key string, dest interface{}) bool

Get loads a cached value. Returns true on hit.

func (*Store) Set

func (s *Store) Set(key string, data interface{}) error

Set stores a value to cache with atomic write.

Jump to

Keyboard shortcuts

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