cache

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	KeyEntityStatement            = "entity_statement"
	KeyOPMetadata                 = "op_metadata"
	KeyEntityConfiguration        = "entity_configuration"
	KeyTrustTree                  = "trust_tree"
	KeyTrustTreeChains            = "trust_tree_chains"
	KeyTrustChainResolvedMetadata = "trustchain_resolved_metadata"
	KeySubordinateListing         = "subordinate_listing"
	KeyExplicitRegistration       = "explicit_registration"
)

Constants for keys for sub caches

Variables

This section is empty.

Functions

func Clear added in v0.8.0

func Clear(prefix string) error

Clear clears all entries with the given prefix

func Delete added in v0.7.1

func Delete(key string) error

Delete deletes the value for the given key from the cache

func EntityStmtCacheKey

func EntityStmtCacheKey(subID, issID string) string

EntityStmtCacheKey constructs a cache key for an EntityStatementPayload

func Get

func Get(key string, target any) (bool, error)

Get obtains a value for the given key from the cache

func Key

func Key(subsystem ...string) string

Key combines a sub system prefix with the key to a cache key

func Set

func Set(key string, value any, duration time.Duration) error

Set caches a value for the given key and duration in the cache

func SetCache

func SetCache(cache Cache)

SetCache sets the Cache that is used

func SetMaxLifetime added in v0.9.0

func SetMaxLifetime(d time.Duration)

SetMaxLifetime sets a maximum lifetime for all cache entries. If d <= 0, the limit is disabled.

func UseNoopCache added in v0.9.0

func UseNoopCache()

UseNoopCache configures the global cache to a no-op implementation, effectively disabling caching across the library.

func UseRedisCache

func UseRedisCache(options *redis.Options) error

UseRedisCache creates a new redis cache with the passed options and sets it to be used

Types

type Cache

type Cache interface {
	Get(key string, target any) (bool, error)
	Set(key string, value any, expiration time.Duration) error
	Delete(key string) error
	// Clear clears all entries with the given prefix
	Clear(prefix string) error
}

Cache is an interface for caching data

Jump to

Keyboard shortcuts

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