MCPcopy Create free account
hub / github.com/VanjaRo/LeetCode / Get

Method Get

tasks/146.go:46–54  ·  view source on GitHub ↗
(key int)

Source from the content-addressed store, hash-verified

44}
45
46func (this *LRUCache) Get(key int) int {
47 n, ok := this.cacheMap[key]
48 if !ok {
49 return -1
50 }
51 this.delete(n)
52 this.pushAfter(this.head, n)
53 return n.value
54}
55
56func (this *LRUCache) Put(key int, value int) {
57 n, ok := this.cacheMap[key]

Callers

nothing calls this directly

Calls 2

deleteMethod · 0.95
pushAfterMethod · 0.95

Tested by

no test coverage detected