Coding: implement a cache for LLM responses.
Asked in the Coding round stage. Listed as 'LLM cache' in the coding-round bullet.
Implement llm_cache(operations, capacity). Each operation is ['put', key, response] or ['get', key]. Return a list containing the response for every get, or None for a miss. A get marks the key as most recently used. When full, inserting a new key evicts the least recently used key. Updating an existing key also makes it most recently used.
def llm_cache(operations, capacity):