Documentation ¶
Overview ¶
Package ttl provides a synchronised map that auto-expire
This package is simply to provide a storage for session.
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] struct { // contains filtered or unexported fields }
Cache is a synchronised map of items that auto-expire once stale
func NewCache ¶
func NewCache[K comparable, V any](ttl time.Duration) *Cache[K, V]
NewCache 创建指定生命周期的 Cache
func NewCacheOn ¶
func NewCacheOn[K comparable, V any](ttl time.Duration, on [4]func(K, V)) *Cache[K, V]
NewCacheOn 创建指定生命周期的 Cache
on: [onset, onget, ondel, ontouch]
Click to show internal directories.
Click to hide internal directories.