MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / Get

Method Get

go/0146-lru-cache.go:39–46  ·  view source on GitHub ↗
(key int)

Source from the content-addressed store, hash-verified

37}
38
39func (this *LRUCache) Get(key int) int {
40 if _, ok := this.cache[key]; ok {
41 this.Remove(this.cache[key])
42 this.Insert(this.cache[key])
43 return this.cache[key].val
44 }
45 return -1
46}
47
48
49func (this *LRUCache) Put(key int, value int) {

Callers

nothing calls this directly

Calls 2

RemoveMethod · 0.95
InsertMethod · 0.95

Tested by

no test coverage detected