feat: rework cache package - add gcs cache - add cache purge command (#750)

* feat: rework cache pkg

Signed-off-by: Matthis Holleville <matthish29@gmail.com>

* feat: Completion of cache pkg rework. Added cache purge command.

Signed-off-by: Matthis Holleville <matthish29@gmail.com>

* doc: add purgin command note

Signed-off-by: Matthis Holleville <matthish29@gmail.com>

* fix: disable cache if noCache is set

Signed-off-by: Matthis Holleville <matthish29@gmail.com>

* feat: improve GetCacheConfiguration lisibility & transform add method to addOrUpdate

Signed-off-by: Matthis Holleville <matthish29@gmail.com>

* feat: transform server mode to work with new cache configuration

Signed-off-by: Matthis Holleville <matthish29@gmail.com>

* fix: use 'switch' instead 'if' to evaluate Cache from grpc

Signed-off-by: Matthis Holleville <matthish29@gmail.com>

* feat: add mutually exclusive flags for command options

Signed-off-by: Matthis Holleville <matthish29@gmail.com>

* doc: update readme.md

Signed-off-by: Matthis Holleville <matthish29@gmail.com>

* feat: return err on bucket creation failed

Signed-off-by: Matthis Holleville <matthish29@gmail.com>

* feat: update dependencies

Signed-off-by: Matthis Holleville <matthish29@gmail.com>

---------

Signed-off-by: Matthis Holleville <matthish29@gmail.com>
Signed-off-by: Matthis <matthish29@gmail.com>
This commit is contained in:
Matthis
2023-11-18 22:08:38 +01:00
committed by GitHub
parent beaa53251c
commit 12146bf356
14 changed files with 563 additions and 186 deletions

View File

@@ -115,18 +115,22 @@ func NewAnalysis(backend string, language string, filters []string, namespace st
}
// load remote cache if it is configured
remoteCacheEnabled, err := cache.RemoteCacheEnabled()
cache, err := cache.GetCacheConfiguration()
if err != nil {
return nil, err
}
if noCache {
cache.DisableCache()
}
return &Analysis{
Context: ctx,
Filters: filters,
Client: client,
AIClient: aiClient,
Namespace: namespace,
Cache: cache.New(noCache, remoteCacheEnabled),
Cache: cache,
Explain: explain,
MaxConcurrency: maxConcurrency,
AnalysisAIProvider: backend,