MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / ClearClusterCache

Method ClearClusterCache

pkg/api/client.go:284–299  ·  view source on GitHub ↗

ClearClusterCache selectively invalidates cluster-level cache entries instead of wiping the entire cache. This preserves node-level cached data (disks, updates) that rarely changes, avoiding unnecessary API round-trips during refresh.

()

Source from the content-addressed store, hash-verified

282// data (disks, updates) that rarely changes, avoiding unnecessary API
283// round-trips during refresh.
284func (c *Client) ClearClusterCache() {
285 clusterPaths := []string{
286 "/cluster/status",
287 "/cluster/resources",
288 "/cluster/tasks",
289 }
290
291 for _, path := range clusterPaths {
292 cacheKey := fmt.Sprintf("proxmox_api_%s_%s", c.baseURL, path)
293 cacheKey = strings.ReplaceAll(cacheKey, "/", "_")
294
295 _ = c.cache.Delete(cacheKey)
296 }
297
298 c.logger.Debug("Cluster-level cache entries cleared selectively")
299}
300
301// ClearNodeCache selectively invalidates cache entries for a specific node.
302// This is more efficient than clearing the entire cache when only one node's

Calls 2

DeleteMethod · 0.65
DebugMethod · 0.65

Tested by

no test coverage detected