Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KV ¶
type KV[K comparable, V any] struct { // contains filtered or unexported fields }
KV is a thread-safe, generic key-value store.
func NewKV ¶
func NewKV[K comparable, V any]() *KV[K, V]
NewKV initializes and returns a new generic KV store.
func (*KV[K, V]) Clear ¶
func (s *KV[K, V]) Clear()
Clear removes all keys and resets the inner map.
func (*KV[K, V]) Delete ¶
func (s *KV[K, V]) Delete(key K)
Delete removes a key-value pair from the store.
func (*KV[K, V]) DeleteIf ¶
DeleteIf removes key only when the stored value equals expected (same lock). Returns true if the key was deleted.
V must be comparable at runtime (e.g. pointers, strings, ints). Comparing non-comparable values (slices, maps, funcs) panics — same as Go interface ==.
Click to show internal directories.
Click to hide internal directories.