newCache (cache/cache.go)

portainer · pkg/libhelm/cache/cache.go · go · Zlib
database, tag:knn-classified

Module exposing: newCache, getByRegistryID, setByRegistryID, flushRegistry, flushAll, generateRegistryIDCacheKey, Cache, CachedRegistryClient

// Source: https://github.com/portainer/portainer | License: Zlib | Copyright 2018 Portainer.io
// Provided via justclaw.it.com; keep this notice with the code.
package cache

import (
	"fmt"
	"time"

	"github.com/patrickmn/go-cache"
	portainer "github.com/portainer/portainer/api"
	"github.com/rs/zerolog/log"
	"helm.sh/helm/v4/pkg/registry"
)

// Cache manages Helm registry clients with TTL-based expiration
// Registry clients are cached per registry ID rather than per user session
// to optimize rate limiting - one login per registry per Portainer instance
type Cache struct {
	cache *cache.Cache
}

// CachedRegistryClient wraps a registry client with metadata
type CachedRegistryClient struct {
	Client     *registry.Client
	RegistryID portainer.RegistryID
	CreatedAt  time.Time
}

// newCac

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key