Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiskCache ¶
type DiskCache struct {
// contains filtered or unexported fields
}
DiskCache stores charts on disk with TTL expiration and concurrency safety.
func NewDiskCache ¶
NewDiskCache creates a new cache instance using functional options. It starts a background goroutine for cleanup automatically.
func (*DiskCache) Get ¶
func (c *DiskCache) Get(uri, version string) (io.ReadCloser, bool)
Get retrieves a chart stream from the disk cache. It returns an io.ReadCloser which MUST be closed by the caller to avoid file handle leaks. Memory Impact: Low (Streaming).
func (*DiskCache) Set ¶
Set streams a chart from the source Reader to the disk cache. It uses atomic writes (write to temp -> rename) to ensure integrity.
func (*DiskCache) Stop ¶
func (c *DiskCache) Stop()
Stop halts the background cleanup goroutine to prevent leaks. It is idempotent and safe to call concurrently: a bare close(c.stopCh) panics with "close of closed channel" on the second call, which turned a harmless double-cleanup into a process crash. Stop is reached from the helm client's Close(), and callers legitimately end up invoking that more than once — a deferred close on a client variable that was reassigned, a Close in both an error path and a defer, or two goroutines shutting down together. Failing loudly there punished correct cleanup, so callers were discouraged from closing at all, which is how the cleanup goroutine leaked in the first place (krateo-platformops/core-provider#99). TTLCache already guards its stop channel this way; this makes DiskCache consistent with it.
type Option ¶
type Option func(*DiskCache)
Option defines the functional pattern for configuration.
func WithCleanupInterval ¶
WithCleanupInterval sets how often the cache scans for expired items. Default: 1 Hour