mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-09-21 11:17:17 +00:00
feat: caching (#439)
* feat: added the ability to set a user default AI provider Signed-off-by: Alex Jones <alexsimonjones@gmail.com> * feat: added the ability to set a user default AI provider Signed-off-by: Alex Jones <alexsimonjones@gmail.com> * feat: s3 based caching Signed-off-by: Alex Jones <alexsimonjones@gmail.com> * feat: s3 based caching Signed-off-by: Alex Jones <alexsimonjones@gmail.com> * updated README.md Signed-off-by: Alex Jones <alexsimonjones@gmail.com> * update README.md Signed-off-by: Alex Jones <alexsimonjones@gmail.com> * updated README.md Signed-off-by: Alex Jones <alexsimonjones@gmail.com> * chore: region is a must have Signed-off-by: Alex Jones <alexsimonjones@gmail.com> * chore: clarified remove command * updated remove.go Signed-off-by: Alex Jones <alexsimonjones@gmail.com> * chore: test fmt causing issues will open another pr Signed-off-by: Alex Jones <alexsimonjones@gmail.com> --------- Signed-off-by: Alex Jones <alexsimonjones@gmail.com>
This commit is contained in:
19
pkg/cache/file_based.go
vendored
19
pkg/cache/file_based.go
vendored
@@ -19,6 +19,25 @@ func (f *FileBasedCache) IsCacheDisabled() bool {
|
||||
return f.noCache
|
||||
}
|
||||
|
||||
func (*FileBasedCache) List() ([]string, error) {
|
||||
path, err := xdg.CacheFile("k8sgpt")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
files, err := os.ReadDir(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var result []string
|
||||
for _, file := range files {
|
||||
result = append(result, file.Name())
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (*FileBasedCache) Exists(key string) bool {
|
||||
path, err := xdg.CacheFile(filepath.Join("k8sgpt", key))
|
||||
|
||||
|
Reference in New Issue
Block a user