cache

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheManager

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

CacheManager handles commit message caching operations.

func NewCacheManager

func NewCacheManager() (*CacheManager, error)

NewCacheManager creates a new cache manager instance.

func (*CacheManager) Cleanup

func (cm *CacheManager) Cleanup() error

Cleanup removes old entries based on age and access count.

func (*CacheManager) Clear

func (cm *CacheManager) Clear() error

Clear removes all entries from the cache.

func (*CacheManager) Get

func (cm *CacheManager) Get(provider types.LLMProvider, diff string, opts *types.GenerationOptions) (*types.CacheEntry, bool)

Get retrieves a cached commit message if it exists.

func (*CacheManager) GetStats

func (cm *CacheManager) GetStats() *types.CacheStats

GetStats returns cache statistics.

func (*CacheManager) Set

func (cm *CacheManager) Set(provider types.LLMProvider, diff string, opts *types.GenerationOptions, message string, cost float64, tokens *types.UsageInfo) error

Set stores a commit message in the cache.

type DiffHasher

type DiffHasher struct{}

DiffHasher generates consistent hash keys for git diffs to enable caching.

func NewDiffHasher

func NewDiffHasher() *DiffHasher

NewDiffHasher creates a new DiffHasher instance.

func (*DiffHasher) GenerateCacheKey

func (h *DiffHasher) GenerateCacheKey(provider types.LLMProvider, diff string, opts *types.GenerationOptions) string

GenerateCacheKey creates a complete cache key including provider information.

func (*DiffHasher) GenerateHash

func (h *DiffHasher) GenerateHash(diff string, opts *types.GenerationOptions) string

GenerateHash creates a hash key for a given diff and generation options. This hash is used as the cache key to identify similar diffs.

Jump to

Keyboard shortcuts

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