What is the best way to implement an LRU cache from scratch using a doubly linked list and a hash map?
Implement lru_cache(operations, capacity). Each operation is ['put', key, value] or ['get', key]. Return the values produced by get, using -1 for missing keys. A successful get and every put mark the key as most recently used; when full, evict the least recently used key.
Example: [['put', 1, 10], ['put', 2, 20], ['get', 1], ['put', 3, 30], ['get', 2]], capacity 2 returns [10, -1].
Constraints: capacity is positive, keys and values are integers, and there are at most 1,000 operations.
def lru_cache(operations, capacity):