cache

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package cache provides TTL-based caching for signal processing.

The TTLCache provides thread-safe caching with automatic expiration. It is used by the K8s Enricher to cache namespace lookups and reduce API server load.

Per IMPLEMENTATION_PLAN_V1.21.md Day 3 specification.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TTLCache

type TTLCache struct {
	// contains filtered or unexported fields
}

TTLCache provides thread-safe caching with automatic TTL expiration.

func NewTTLCache

func NewTTLCache(ttl time.Duration) *TTLCache

NewTTLCache creates a new TTLCache with the specified TTL duration.

func (*TTLCache) Clear

func (c *TTLCache) Clear()

Clear removes all entries from the cache.

func (*TTLCache) Delete

func (c *TTLCache) Delete(key string)

Delete removes a key from the cache.

func (*TTLCache) Get

func (c *TTLCache) Get(key string) (interface{}, bool)

Get retrieves a value from the cache. Returns the value and true if found and not expired, nil and false otherwise.

func (*TTLCache) Len

func (c *TTLCache) Len() int

Len returns the number of entries in the cache (including expired ones).

func (*TTLCache) Set

func (c *TTLCache) Set(key string, value interface{})

Set stores a value in the cache with the configured TTL.

Jump to

Keyboard shortcuts

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