package cache
import "github.com/plgd-dev/go-coap/v3/pkg/cache"
Index ¶
- func DefaultOnExpire[D any](D)
- type Cache
- func NewCache[K comparable, D any]() *Cache[K, D]
- func (c *Cache[K, D]) CheckExpirations(now time.Time)
- func (c *Cache[K, D]) Load(key K) (actual *Element[D])
- func (c *Cache[K, D]) LoadOrStore(key K, e *Element[D]) (actual *Element[D], loaded bool)
- type Element
Functions ¶
func DefaultOnExpire ¶
func DefaultOnExpire[D any](D)
Types ¶
type Cache ¶
type Cache[K comparable, D any] struct { *sync.Map[K, *Element[D]] }
func NewCache ¶
func NewCache[K comparable, D any]() *Cache[K, D]
func (*Cache[K, D]) CheckExpirations ¶
func (*Cache[K, D]) Load ¶
func (*Cache[K, D]) LoadOrStore ¶
type Element ¶
func NewElement ¶
func (*Element[D]) Data ¶
func (e *Element[D]) Data() D
func (*Element[D]) IsExpired ¶
Source Files ¶
- Version
- v3.3.6 (latest)
- Published
- Sep 18, 2024
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 1 week ago –
Tools for package owners.