Documentation
¶
Index ¶
- Constants
- type CacheManager
- func (cm *CacheManager) ClearCache() error
- func (cm *CacheManager) GetCachedResults(azureYamlPath string) (*ReqsCache, bool, error)
- func (cm *CacheManager) GetStats() CacheStats
- func (cm *CacheManager) IsEnabled() bool
- func (cm *CacheManager) SaveResults(azureYamlPath string, results []CachedReqResult, allPassed bool) error
- type CacheOptions
- type CacheStats
- type CachedReqResult
- type ReqsCache
Constants ¶
const ( // CacheVersion tracks the cache schema version for invalidation on breaking changes CacheVersion = "1.0" // DefaultCacheTTL is the default cache time-to-live DefaultCacheTTL = 1 * time.Hour )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheManager ¶
type CacheManager struct {
// contains filtered or unexported fields
}
CacheManager handles reqs cache operations.
func NewCacheManager ¶
func NewCacheManager() (*CacheManager, error)
NewCacheManager creates a new cache manager with default options.
func NewCacheManagerWithOptions ¶
func NewCacheManagerWithOptions(opts CacheOptions) (*CacheManager, error)
NewCacheManagerWithOptions creates a new cache manager with custom options.
func (*CacheManager) ClearCache ¶
func (cm *CacheManager) ClearCache() error
ClearCache removes the reqs cache.
func (*CacheManager) GetCachedResults ¶
func (cm *CacheManager) GetCachedResults(azureYamlPath string) (*ReqsCache, bool, error)
GetCachedResults retrieves cached reqs check results if valid.
func (*CacheManager) GetStats ¶
func (cm *CacheManager) GetStats() CacheStats
GetStats returns cache hit/miss statistics.
func (*CacheManager) IsEnabled ¶
func (cm *CacheManager) IsEnabled() bool
IsEnabled returns whether caching is enabled.
func (*CacheManager) SaveResults ¶
func (cm *CacheManager) SaveResults(azureYamlPath string, results []CachedReqResult, allPassed bool) error
SaveResults saves reqs check results to cache. Only caches successful results (allPassed=true) to avoid blocking users with stale failures.
type CacheOptions ¶
type CacheOptions struct {
CacheDir string // Custom cache directory (optional)
TTL time.Duration // Cache time-to-live (default: 1 hour)
Enabled bool // Enable/disable caching
}
CacheOptions configures the cache manager.
type CacheStats ¶
CacheStats tracks cache hit/miss statistics.
type CachedReqResult ¶
type CachedReqResult struct {
Name string `json:"name"`
Installed bool `json:"installed"`
Version string `json:"version,omitempty"`
Required string `json:"required"`
Satisfied bool `json:"satisfied"`
Running bool `json:"running,omitempty"`
CheckedRun bool `json:"checkedRunning,omitempty"`
Message string `json:"message,omitempty"`
}
CachedReqResult represents a cached req check result.
type ReqsCache ¶
type ReqsCache struct {
Version string `json:"version"` // Schema version for invalidation
Timestamp time.Time `json:"timestamp"`
AzureYamlHash string `json:"azureYamlHash"`
Results []CachedReqResult `json:"results"`
AllPassed bool `json:"allPassed"`
}
ReqsCache represents cached reqs check results.