Documentation ¶
Index ¶
- Variables
- type DoublyLinkedList
- func (list *DoublyLinkedList) Add(value interface{}) *DoublyLinkedListEntry
- func (list *DoublyLinkedList) AddEntry(entry *DoublyLinkedListEntry)
- func (list *DoublyLinkedList) AddFirst(value interface{}) *DoublyLinkedListEntry
- func (list *DoublyLinkedList) AddFirstEntry(entry *DoublyLinkedListEntry)
- func (list *DoublyLinkedList) AddLast(value interface{}) *DoublyLinkedListEntry
- func (list *DoublyLinkedList) AddLastEntry(entry *DoublyLinkedListEntry)
- func (list *DoublyLinkedList) Clear()
- func (list *DoublyLinkedList) GetFirst() (interface{}, error)
- func (list *DoublyLinkedList) GetFirstEntry() (*DoublyLinkedListEntry, error)
- func (list *DoublyLinkedList) GetLast() (interface{}, error)
- func (list *DoublyLinkedList) GetLastEntry() (*DoublyLinkedListEntry, error)
- func (list *DoublyLinkedList) GetSize() int
- func (list *DoublyLinkedList) Remove(value interface{}) error
- func (list *DoublyLinkedList) RemoveEntry(entry *DoublyLinkedListEntry) error
- func (list *DoublyLinkedList) RemoveFirst() (interface{}, error)
- func (list *DoublyLinkedList) RemoveFirstEntry() (*DoublyLinkedListEntry, error)
- func (list *DoublyLinkedList) RemoveLast() (interface{}, error)
- func (list *DoublyLinkedList) RemoveLastEntry() (*DoublyLinkedListEntry, error)
- type DoublyLinkedListEntry
- func (entry *DoublyLinkedListEntry) GetNext() *DoublyLinkedListEntry
- func (entry *DoublyLinkedListEntry) GetPrev() *DoublyLinkedListEntry
- func (entry *DoublyLinkedListEntry) GetValue() interface{}
- func (entry *DoublyLinkedListEntry) SetNext(next *DoublyLinkedListEntry)
- func (entry *DoublyLinkedListEntry) SetPrev(prev *DoublyLinkedListEntry)
- func (entry *DoublyLinkedListEntry) SetValue(value interface{})
- type KRWMutex
- type LRUCache
- func (cache *LRUCache) ComputeIfAbsent(key interface{}, callback func() interface{}) (result interface{})
- func (cache *LRUCache) ComputeIfPresent(key interface{}, callback func(value interface{}) interface{}) (result interface{})
- func (cache *LRUCache) Contains(key interface{}) (result bool)
- func (cache *LRUCache) Delete(key interface{}) bool
- func (cache *LRUCache) DeleteAll()
- func (cache *LRUCache) DeleteWithoutEviction(key interface{}) (existed bool, keyToEvict interface{}, valueToEvict interface{})
- func (cache *LRUCache) Get(key interface{}) (result interface{})
- func (cache *LRUCache) GetCapacity() int
- func (cache *LRUCache) GetSize() int
- func (cache *LRUCache) Set(key interface{}, value interface{})
- type LRUCacheOptions
- type RandomMap
- func (rmap *RandomMap) Delete(key interface{}) (result interface{}, exists bool)
- func (rmap *RandomMap) Get(key interface{}) (result interface{}, exists bool)
- func (rmap *RandomMap) RandomEntry() (result interface{})
- func (rmap *RandomMap) Set(key interface{}, value interface{})
- func (rmap *RandomMap) Size() (result int)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoSuchElement = errors.New("element does not exist") ErrInvalidArgument = errors.New("invalid argument") )
View Source
var DEFAULT_OPTIONS = &LRUCacheOptions{ EvictionCallback: nil, EvictionBatchSize: 1, IdleTimeout: 30 * time.Second, }
Functions ¶
This section is empty.
Types ¶
type DoublyLinkedList ¶
type DoublyLinkedList struct {
// contains filtered or unexported fields
}
func (*DoublyLinkedList) Add ¶
func (list *DoublyLinkedList) Add(value interface{}) *DoublyLinkedListEntry
Appends the specified value to the end of this list.
func (*DoublyLinkedList) AddEntry ¶
func (list *DoublyLinkedList) AddEntry(entry *DoublyLinkedListEntry)
Appends the specified element to the end of this list.
func (*DoublyLinkedList) AddFirst ¶
func (list *DoublyLinkedList) AddFirst(value interface{}) *DoublyLinkedListEntry
func (*DoublyLinkedList) AddFirstEntry ¶
func (list *DoublyLinkedList) AddFirstEntry(entry *DoublyLinkedListEntry)
func (*DoublyLinkedList) AddLast ¶
func (list *DoublyLinkedList) AddLast(value interface{}) *DoublyLinkedListEntry
func (*DoublyLinkedList) AddLastEntry ¶
func (list *DoublyLinkedList) AddLastEntry(entry *DoublyLinkedListEntry)
func (*DoublyLinkedList) Clear ¶
func (list *DoublyLinkedList) Clear()
func (*DoublyLinkedList) GetFirst ¶
func (list *DoublyLinkedList) GetFirst() (interface{}, error)
func (*DoublyLinkedList) GetFirstEntry ¶
func (list *DoublyLinkedList) GetFirstEntry() (*DoublyLinkedListEntry, error)
func (*DoublyLinkedList) GetLast ¶
func (list *DoublyLinkedList) GetLast() (interface{}, error)
func (*DoublyLinkedList) GetLastEntry ¶
func (list *DoublyLinkedList) GetLastEntry() (*DoublyLinkedListEntry, error)
func (*DoublyLinkedList) GetSize ¶
func (list *DoublyLinkedList) GetSize() int
func (*DoublyLinkedList) Remove ¶
func (list *DoublyLinkedList) Remove(value interface{}) error
func (*DoublyLinkedList) RemoveEntry ¶
func (list *DoublyLinkedList) RemoveEntry(entry *DoublyLinkedListEntry) error
func (*DoublyLinkedList) RemoveFirst ¶
func (list *DoublyLinkedList) RemoveFirst() (interface{}, error)
func (*DoublyLinkedList) RemoveFirstEntry ¶
func (list *DoublyLinkedList) RemoveFirstEntry() (*DoublyLinkedListEntry, error)
func (*DoublyLinkedList) RemoveLast ¶
func (list *DoublyLinkedList) RemoveLast() (interface{}, error)
func (*DoublyLinkedList) RemoveLastEntry ¶
func (list *DoublyLinkedList) RemoveLastEntry() (*DoublyLinkedListEntry, error)
type DoublyLinkedListEntry ¶
type DoublyLinkedListEntry struct {
// contains filtered or unexported fields
}
func (*DoublyLinkedListEntry) GetNext ¶
func (entry *DoublyLinkedListEntry) GetNext() *DoublyLinkedListEntry
func (*DoublyLinkedListEntry) GetPrev ¶
func (entry *DoublyLinkedListEntry) GetPrev() *DoublyLinkedListEntry
func (*DoublyLinkedListEntry) GetValue ¶
func (entry *DoublyLinkedListEntry) GetValue() interface{}
func (*DoublyLinkedListEntry) SetNext ¶
func (entry *DoublyLinkedListEntry) SetNext(next *DoublyLinkedListEntry)
func (*DoublyLinkedListEntry) SetPrev ¶
func (entry *DoublyLinkedListEntry) SetPrev(prev *DoublyLinkedListEntry)
func (*DoublyLinkedListEntry) SetValue ¶
func (entry *DoublyLinkedListEntry) SetValue(value interface{})
type KRWMutex ¶
type KRWMutex struct {
// contains filtered or unexported fields
}
func NewKRWMutex ¶
func NewKRWMutex() *KRWMutex
type LRUCache ¶
type LRUCache struct {
// contains filtered or unexported fields
}
func NewLRUCache ¶
func NewLRUCache(capacity int, options ...*LRUCacheOptions) *LRUCache
func (*LRUCache) ComputeIfAbsent ¶
func (cache *LRUCache) ComputeIfAbsent(key interface{}, callback func() interface{}) (result interface{})
func (*LRUCache) ComputeIfPresent ¶
func (cache *LRUCache) ComputeIfPresent(key interface{}, callback func(value interface{}) interface{}) (result interface{})
Calls the callback if an entry with the given key exists. The result of the callback is written back into the cache. If the callback returns nil the entry is removed from the cache. Returns the updated entry.
func (*LRUCache) DeleteWithoutEviction ¶
func (*LRUCache) GetCapacity ¶
type LRUCacheOptions ¶
Click to show internal directories.
Click to hide internal directories.