Documentation ¶
Index ¶
- type KeyPair
- type LRUCache
- func (cache *LRUCache) Get(bk int64) (*common.Block, bool)
- func (cache *LRUCache) Keys() []int64
- func (cache *LRUCache) LeastRecentlyUsed() *common.Block
- func (cache *LRUCache) Print()
- func (cache *LRUCache) Purge()
- func (cache *LRUCache) Put(key int64, value *common.Block) bool
- func (cache *LRUCache) RecentlyUsed() *common.Block
- func (cache *LRUCache) Remove(key int64)
- func (cache *LRUCache) Resize(bk, newEndIndex int64) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyPair ¶
type KeyPair struct {
// contains filtered or unexported fields
}
KeyPair: the list node containing both block key and cache block values
type LRUCache ¶
type LRUCache struct { sync.RWMutex Capacity int64 List *list.List //DoublyLinkedList: node1->node2.... node:=KeyPair Elements map[int64]*list.Element //blockKey:KeyPair Occupied int64 }
LRUCache definition for Least Recently Used Cache implementation
func NewLRUCache ¶
NewLRUCache: creates a new LRUCache object with the defined capacity
func (*LRUCache) Get ¶
Get: returns the cache value stored for the key, cache hits the handle and moves the list pointer to front of the list
func (*LRUCache) LeastRecentlyUsed ¶
func (*LRUCache) RecentlyUsed ¶
Click to show internal directories.
Click to hide internal directories.