Documentation
¶
Index ¶
- type CacheManager
- func (cm *CacheManager) Cleanup() error
- func (cm *CacheManager) Clear() error
- func (cm *CacheManager) Get(provider types.LLMProvider, diff string, opts *types.GenerationOptions) (*types.CacheEntry, bool)
- func (cm *CacheManager) GetStats() *types.CacheStats
- func (cm *CacheManager) Set(provider types.LLMProvider, diff string, opts *types.GenerationOptions, ...) error
- type DiffHasher
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.