Let's implement get! All get needs to do is find a key in this.cache. If found, we moveToHead to let keep it as the most recently used key, and return it. Otherwise, we return -1.
1def get(key):
2 node = this.cache[key]
3 if not node:
4 return -1
5 self.moveToHead(node)
6 return node.val