Documentation
¶
Index ¶
- Constants
- func Clear(gemfileLockPath string) error
- func ClearHealth(gemfileLockPath string) error
- func GetCacheDir() (string, error)
- func GetCachePath(gemfileLockPath string) (string, error)
- func Write(gemfileLockPath string, entry *CacheEntry) error
- func WriteHealth(gemfileLockPath string, entry *HealthCacheEntry) error
- type CacheEntry
- type HealthCacheEntry
Constants ¶
View Source
const HealthCacheTTL = 12 * 24 * time.Hour
HealthCacheTTL is the time-to-live for cached health data Health metrics change on a "years" timescale, so 12 days is conservative while drastically reducing API calls on subsequent runs
Variables ¶
This section is empty.
Functions ¶
func ClearHealth ¶ added in v1.1.2
ClearHealth removes the health cache entry for a given Gemfile.lock
func GetCachePath ¶
GetCachePath returns the cache file path for a given Gemfile.lock
func Write ¶
func Write(gemfileLockPath string, entry *CacheEntry) error
Write writes analysis result to cache
func WriteHealth ¶ added in v1.1.0
func WriteHealth(gemfileLockPath string, entry *HealthCacheEntry) error
WriteHealth writes health data to cache
Types ¶
type CacheEntry ¶
type CacheEntry struct {
Result *gemfile.AnalysisResult `json:"result"`
GemfileLockMtime int64 `json:"gemfile_lock_mtime"`
CachedAt time.Time `json:"cached_at"`
RubyVersion string `json:"ruby_version"`
BundleVersion string `json:"bundle_version"`
FrameworkDetected string `json:"framework_detected"`
RailsVersion string `json:"rails_version"`
}
CacheEntry represents a cached analysis result with metadata
func Read ¶
func Read(gemfileLockPath string) (*CacheEntry, error)
Read reads cached analysis result if it exists and is valid
type HealthCacheEntry ¶ added in v1.1.0
type HealthCacheEntry struct {
Gems map[string]*gemfile.GemHealth `json:"gems"`
CachedAt time.Time `json:"cached_at"`
}
HealthCacheEntry stores gem health data with a 12-day TTL
func ReadHealth ¶ added in v1.1.0
func ReadHealth(gemfileLockPath string) (*HealthCacheEntry, error)
ReadHealth reads health cache for a Gemfile.lock if it exists and is less than 12 days old
Click to show internal directories.
Click to hide internal directories.