Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { Get(key interface{}) (data interface{}, ok bool) Add(key interface{}, data interface{}) Remove(key interface{}) }
Cache is a generic interface that can be implemented by most types of caches.
type Disabled ¶
type Disabled struct{}
Disabled implements the Cache interface but implements no-op methods that return false. This allows callers to interact with a cache without having to check if it's enabled.
type TTL ¶
type TTL struct {
// contains filtered or unexported fields
}
TTL is a wrapper around a thread-safe LRU cache that adds a time-to-live value to each entry.
func (*TTL) Add ¶
func (c *TTL) Add(key interface{}, data interface{})
Add stores data in the cache by key.
Click to show internal directories.
Click to hide internal directories.