Documentation ¶
Overview ¶
Package cl provides a simple goroutine-safe capped list implementation.
Index ¶
- type CappedList
- func (cl *CappedList) Add(key Key, value interface{})
- func (cl *CappedList) All() map[Key]interface{}
- func (cl *CappedList) Contains(key Key) bool
- func (cl *CappedList) Get(key Key) (interface{}, bool)
- func (cl *CappedList) Len() int
- func (cl *CappedList) Limit() int
- func (cl *CappedList) Remove(key Key)
- type Key
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CappedList ¶
type CappedList struct {
// contains filtered or unexported fields
}
CappedList is a capped list where old items are evicted to make room for new items.
func (*CappedList) Add ¶
func (cl *CappedList) Add(key Key, value interface{})
Add adds an item to the CappedList with the given key and value.
func (*CappedList) All ¶
func (cl *CappedList) All() map[Key]interface{}
All return all elements in the CappedList.
func (*CappedList) Contains ¶
func (cl *CappedList) Contains(key Key) bool
Test determines whether the CappedList contains an item, returning true or false.
func (*CappedList) Get ¶
func (cl *CappedList) Get(key Key) (interface{}, bool)
Get returns an item from the list, returning the value and a bool representing whether or not it was found.
func (*CappedList) Len ¶
func (cl *CappedList) Len() int
Len returns the number of entries in the CappedList.
func (*CappedList) Limit ¶
func (cl *CappedList) Limit() int
Limit returns the capacity of the CappedList.
func (*CappedList) Remove ¶
func (cl *CappedList) Remove(key Key)
Remove removes an item from the CappedList by key.
Click to show internal directories.
Click to hide internal directories.