Write LRU Cache with put and get method.
Asked in the DSA round stage. Implement an LRUCache supporting constant-time average get and put operations. When capacity is exceeded, evict the least recently used key.
Use lru_cache(capacity, operations), where each operation is ['put', key, value] or ['get', key]. Return the values produced by get, using -1 for missing keys.
def lru_cache(capacity, operations):