MCPcopy
hub / github.com/henrygd/beszel / Set

Method Set

internal/hub/expirymap/expirymap.go:35–40  ·  view source on GitHub ↗

Set stores a value with the given TTL

(key string, value T, ttl time.Duration)

Source from the content-addressed store, hash-verified

33
34// Set stores a value with the given TTL
35func (m *ExpiryMap[T]) Set(key string, value T, ttl time.Duration) {
36 m.store.Set(key, val[T]{
37 value: value,
38 expires: time.Now().Add(ttl),
39 })
40}
41
42// GetOk retrieves a value and checks if it exists and hasn't expired
43// Performs lazy cleanup of expired entries on access

Calls

no outgoing calls