Documentation
¶
Index ¶
- type CacheStats
- type LRUCache
- func (c *LRUCache) Clear()
- func (c *LRUCache) Delete(key string)
- func (c *LRUCache) Get(key string) (interface{}, bool)
- func (c *LRUCache) GetOrCreate(key string, createFunc func() interface{}) interface{}
- func (c *LRUCache) Len() int
- func (c *LRUCache) Put(key string, value interface{}, ttl time.Duration)
- func (c *LRUCache) Stats() CacheStats
- func (c *LRUCache) Warmup(keys []string, factory func(key string) interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheStats ¶
CacheStats contains cache statistics.
type LRUCache ¶
type LRUCache struct {
// contains filtered or unexported fields
}
LRUCache provides a thread-safe LRU cache with optional TTL.
func NewLRUCache ¶
NewLRUCache creates a new LRU cache with the specified capacity.
func (*LRUCache) GetOrCreate ¶
GetOrCreate retrieves a value from the cache or creates it using the provided function.
Click to show internal directories.
Click to hide internal directories.