Documentation
¶
Index ¶
- Constants
- func CalculateFileHash(filePath string) (string, error)
- type CacheData
- type CacheStats
- type Entry
- type FileCache
- func (fc *FileCache) AddIgnoredRule(filePattern, ruleType string) error
- func (fc *FileCache) ClearCache() error
- func (fc *FileCache) Close() error
- func (fc *FileCache) GetCacheDir() string
- func (fc *FileCache) GetFileRecord(filePath string) (*FileRecord, error)
- func (fc *FileCache) GetStats() map[string]interface{}
- func (fc *FileCache) IgnoreIssue(filePath, issueID, ignoreType string) error
- func (fc *FileCache) IsFileChanged(filePath string) (bool, error)
- func (fc *FileCache) IsIssueIgnored(filePath, issueID string) (bool, error)
- func (fc *FileCache) MarkIssueFixed(filePath, issueID string) error
- func (fc *FileCache) SaveFileRecord(filePath string, issues []interface{}) error
- func (fc *FileCache) SaveRawRecord(key string, entry Entry) error
- func (fc *FileCache) ShouldIgnoreRule(filePath, ruleType string) bool
- type FileRecord
- type HybridCache
- type IgnoredRule
Constants ¶
const ( CacheDir = ".abscleaner" CacheFile = "cache.json" CacheVersion = "1.0" )
Variables ¶
This section is empty.
Functions ¶
func CalculateFileHash ¶
CalculateFileHash calculates SHA256 hash of a file using streaming for better memory efficiency
Types ¶
type CacheData ¶
type CacheData struct {
Version string `json:"version"`
Files []*FileRecord `json:"files"`
IgnoredRules []IgnoredRule `json:"ignored_rules"`
Stats *CacheStats `json:"stats"`
LastUpdated time.Time `json:"last_updated"`
}
type CacheStats ¶
type FileCache ¶
type FileCache struct {
// contains filtered or unexported fields
}
func (*FileCache) AddIgnoredRule ¶
AddIgnoredRule adds a rule type to ignore for a file pattern
func (*FileCache) ClearCache ¶
ClearCache clears all cached data
func (*FileCache) GetCacheDir ¶
GetCacheDir returns the cache directory path
func (*FileCache) GetFileRecord ¶
func (fc *FileCache) GetFileRecord(filePath string) (*FileRecord, error)
GetFileRecord retrieves a file record
func (*FileCache) IgnoreIssue ¶
IgnoreIssue marks an issue as ignored
func (*FileCache) IsFileChanged ¶
IsFileChanged checks if a file has changed since last analysis
func (*FileCache) IsIssueIgnored ¶
IsIssueIgnored checks if an issue is ignored
func (*FileCache) MarkIssueFixed ¶
MarkIssueFixed marks an issue as fixed
func (*FileCache) SaveFileRecord ¶
SaveFileRecord saves or updates a file record
func (*FileCache) SaveRawRecord ¶
SaveRawRecord saves a raw Entry directly
func (*FileCache) ShouldIgnoreRule ¶
ShouldIgnoreRule checks if a rule should be ignored for a file
type FileRecord ¶
type HybridCache ¶
type HybridCache struct {
// contains filtered or unexported fields
}
HybridCache combines in-memory LRU cache with disk persistence
func NewHybridCache ¶
func NewHybridCache(baseDir string, maxItems int) (*HybridCache, error)
NewHybridCache creates a new hybrid cache with LRU eviction
func (*HybridCache) Clear ¶
func (hc *HybridCache) Clear() error
Clear clears both memory and disk cache
func (*HybridCache) Flush ¶
func (hc *HybridCache) Flush() error
Flush writes all dirty items to disk
func (*HybridCache) Get ¶
func (hc *HybridCache) Get(key string) (*Entry, bool)
Get retrieves an item from cache (memory first, then disk)
func (*HybridCache) Put ¶
func (hc *HybridCache) Put(key string, entry Entry)
Put adds or updates an item in the cache
func (*HybridCache) Stats ¶
func (hc *HybridCache) Stats() map[string]interface{}
Stats return cache statistics