mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-09-09 19:20:15 +00:00
feat: use OS conform path for storing cached results
Instead of storing cached values in the config yaml, they are now stored under these OS specific locations: * Linux: `~/.cache/k8sgpt` * MacOS: `~/Library/Caches` * Windows: `%LocalAppData%\cache` Additionally a `Cache` package and interface has been introduced. Currently there are two implementations: * Noop - Doesn't do anything * FileBased - Stores data in files under the locations listed above fixes #323 Signed-off-by: Patrick Pichler <git@patrickpichler.dev>
This commit is contained in:
15
pkg/cache/cache.go
vendored
Normal file
15
pkg/cache/cache.go
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
package cache
|
||||
|
||||
type ICache interface {
|
||||
Store(key string, data string) error
|
||||
Load(key string) (string, error)
|
||||
Exists(key string) bool
|
||||
}
|
||||
|
||||
func New(noCache bool) ICache {
|
||||
if noCache {
|
||||
return &NoopCache{}
|
||||
}
|
||||
|
||||
return &FileBasedCache{}
|
||||
}
|
Reference in New Issue
Block a user