cache

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear() error

Clear removes all cached data

func Get

func Get(key CacheKey, target interface{}) (bool, error)

Get retrieves a cached value if it exists and is not expired

func HashID

func HashID(id string) string

HashID creates a short hash for cache keys (for very long IDs)

func Invalidate

func Invalidate(key CacheKey) error

Invalidate removes a cached value

func InvalidatePattern

func InvalidatePattern(resourceType, resourceID string) error

InvalidatePattern removes all cache entries matching a pattern This is useful for invalidating all caches related to a resource

func Set

func Set(key CacheKey, value interface{}) error

Set stores a value in the cache

Types

type CacheKey

type CacheKey struct {
	ResourceType string // "organization", "project", "site"
	Operation    string // "list", "get"
	ParentType   string // optional: parent resource type
	ParentID     string // optional: parent resource ID
	SubResource  string // optional: "firewall", "members", "secrets"
	ResourceID   string // optional: specific resource ID
}

CacheKey represents a structured cache key

func (CacheKey) GetCachePath

func (k CacheKey) GetCachePath() (string, error)

GetCachePath returns the file path for a cache key

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL