Documentation ¶
Index ¶
- type Cache
- func (c *Cache[Key, Value]) Add(key Key, value Value)
- func (c *Cache[Key, Value]) AddOrGet(key Key, value Value) (Value, bool)
- func (c *Cache[Key, Value]) Clear()
- func (c *Cache[Key, Value]) Contain(key Key) bool
- func (c *Cache[Key, Value]) Get(key Key) (value Value, ok bool)
- func (c *Cache[Key, Value]) Keys() []Key
- func (c *Cache[Key, Value]) Len() int
- func (c *Cache[Key, Value]) Peek(key Key) (value Value, ok bool)
- func (c *Cache[Key, Value]) Remove(key Key)
- func (c *Cache[Key, Value]) Values() []Value
- type Cache32
- func (c *Cache32) Add(key uint32, value interface{})
- func (c *Cache32) Clear()
- func (c *Cache32) Contain(key uint32) bool
- func (c *Cache32) Get(key uint32) (value interface{}, ok bool)
- func (c *Cache32) Keys() []uint32
- func (c *Cache32) Len() int
- func (c *Cache32) Peek(key uint32) (value interface{}, ok bool)
- func (c *Cache32) Remove(key uint32)
- func (c *Cache32) Values() []interface{}
- type Cache64
- func (c *Cache64) Add(key uint64, value interface{})
- func (c *Cache64) Clear()
- func (c *Cache64) Contain(key uint64) bool
- func (c *Cache64) Get(key uint64) (value interface{}, ok bool)
- func (c *Cache64) Keys() []uint64
- func (c *Cache64) Len() int
- func (c *Cache64) Peek(key uint64) (value interface{}, ok bool)
- func (c *Cache64) Remove(key uint64)
- func (c *Cache64) Values() []interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[Key comparable, Value any] struct { // contains filtered or unexported fields }
func (*Cache[Key, Value]) AddOrGet ¶
When the key already exists, return its current value in lru and true otherwise insert the new key-value and return nil and false
func (*Cache[Key, Value]) Contain ¶
Contain will check if a key is in the cache, but not modify the list
func (*Cache[Key, Value]) Keys ¶
func (c *Cache[Key, Value]) Keys() []Key
Keys returns a slice of all keys, from oldest to newest
type Cache32 ¶
type Cache32 struct {
// contains filtered or unexported fields
}
func NewCache32 ¶
type Cache64 ¶
type Cache64 struct {
// contains filtered or unexported fields
}
func NewCache64 ¶
Click to show internal directories.
Click to hide internal directories.