Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[K comparable, V any] interface { // Get retrieves the value of the item from the cache. Get(key K) (V, error) // Set stores the value of the item in the cache. Set(key K, value V) error // Delete removes the item from the cache. Delete(key K) error }
Cache is a generic cache interface.
type Item ¶
type Item[V any] struct { // contains filtered or unexported fields }
Item represents a generic item in the cache.
type SimpleCache ¶
type SimpleCache[K comparable, V any] struct { // contains filtered or unexported fields }
SimpleCache is a simple cache implementation using a sync.Map.
func NewSimpleCache ¶
func NewSimpleCache[K comparable, V any]() *SimpleCache[K, V]
NewSimpleCache creates a new SimpleCache.
func (*SimpleCache[K, V]) Delete ¶
func (c *SimpleCache[K, V]) Delete(key K) error
Delete removes the item from the cache.
func (*SimpleCache[K, V]) Get ¶
func (c *SimpleCache[K, V]) Get(key K) (val V, err error)
Get retrieves the value of the item from the cache.
func (*SimpleCache[K, V]) Set ¶
func (c *SimpleCache[K, V]) Set(key K, value V) error
Set stores the value of the item in the cache.
Click to show internal directories.
Click to hide internal directories.