Implement a cache in Python.
Asked in the Coding Test stage. Round 1 coding test for Data Engineer 1 (AmbitionBox review, Oct 2024).
Implement an LRU cache simulator. The function receives a positive capacity and a list of operations. Each operation is either ["put", key, value] or ["get", key]. Return the values from get operations in order, using -1 for missing keys. When full, evict the least recently used key. A successful get and every put make the key most recently used.
def lru_cache_operations(capacity, operations):