Documentation
¶
Overview ¶
Package cache provides a thread-safe TTL + LRU cache used to retain recently completed scan results. Values are bounded both by entry count (LRU eviction, configured via cache.max_entries) and by age (time expiry, configured via cache.ttl). No persistent storage — a restart loses the cache.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewID ¶
NewID returns a 32-hex-character ID derived from host, the scan timestamp, and a 12-byte cryptographic nonce. The nonce dominates the entropy so two scans of the same host at the same instant still receive distinct IDs — the host/timestamp inputs only provide debuggability if a future version chooses to make IDs deterministic.
Types ¶
type Cache ¶
type Cache[V any] struct { // contains filtered or unexported fields }
Cache is a thread-safe TTL + LRU cache keyed by string. Constructed via New.
func New ¶
New builds a Cache. A non-positive maxEntries falls back to 1000 to avoid the underlying lib's "always full" behaviour at size 0. A zero ttl disables time-based expiry (LRU only).
func (*Cache[V]) Get ¶
Get returns the value under key and a presence boolean. A returned false means either the key was never stored or its TTL has elapsed.