(key int)
| 37 | } |
| 38 | |
| 39 | func (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 | |
| 49 | func (this *LRUCache) Put(key int, value int) { |