Documentation ¶ Index ¶ type Cache func (c *Cache[V]) Clear() func (c *Cache[V]) Delete(key string) func (c *Cache[V]) GetOrLoad(key string, getData func() (V, error), timeout time.Duration) (value V) func (c *Cache[V]) GetOrLoadE(key string, getData func() (V, error), timeout time.Duration) (V, error) Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ This section is empty. Types ¶ type Cache ¶ type Cache[V any] struct { // contains filtered or unexported fields } Cache 本 cache 目前不包含定时清理,请在有限场景使用 func (*Cache[V]) Clear ¶ added in v0.1.1 func (c *Cache[V]) Clear() func (*Cache[V]) Delete ¶ added in v0.2.2 func (c *Cache[V]) Delete(key string) func (*Cache[V]) GetOrLoad ¶ func (c *Cache[V]) GetOrLoad( key string, getData func() (V, error), timeout time.Duration, ) (value V) func (*Cache[V]) GetOrLoadE ¶ func (c *Cache[V]) GetOrLoadE( key string, getData func() (V, error), timeout time.Duration, ) (V, error) GetOrLoadE 核心调用方法(满足您要求的参数形式) Source Files ¶ View all Source files cache.go Click to show internal directories. Click to hide internal directories.