feat: Add malysis cache implementation with proxy flow integration (#346)

* feat: Add malysis cache implementation with proxy flow integration

* fix: Code review fixes
This commit is contained in:
Abhisek Datta
2026-06-22 10:12:02 +05:30
committed by GitHub
parent 327c9c7068
commit d360e75897
21 changed files with 820 additions and 21 deletions
+10 -2
View File
@@ -28,7 +28,7 @@ func newMalysisAnalyzer(config MalysisQueryAnalyzerConfig,
creds, closeResolver, err := resolveCredentials()
if err != nil {
log.Debugf("SafeDep Cloud credentials unavailable, using community malysis analyzer: %v", err)
return community, nil
return withCache(community, config), nil
}
defer func() {
if closeErr := closeResolver(); closeErr != nil {
@@ -42,5 +42,13 @@ func newMalysisAnalyzer(config MalysisQueryAnalyzerConfig,
}
log.Debugf("SafeDep Cloud credentials found, using authenticated malysis analyzer with community fallback")
return newMalysisFallbackAnalyzer(authenticated, community), nil
return withCache(newMalysisFallbackAnalyzer(authenticated, community), config), nil
}
// withCache wraps a in a read-through cache decorator when one is configured.
func withCache(a PackageVersionAnalyzer, config MalysisQueryAnalyzerConfig) PackageVersionAnalyzer {
if config.Cache == nil {
return a
}
return newMalysisCachingAnalyzer(a, config.Cache)
}