Airtel Payments Bank services need fast eviction of inactive session data. Implement a fixed-capacity Least Recently Used cache that supports get and put operations in O(1) average time.
Use a hash map for direct key lookup and a custom doubly linked list to maintain usage order. The most recently used item must be at the front, and the least recently used item must be at the back.
Implement lru_cache_operations(capacity, operations).
capacity is a positive integer.operations is a list of operation arrays. Each operation is either ['get', key] or ['put', key, value].get operation, in order.-1 for a cache miss.get marks the key as most recently used.put also marks it as most recently used.def lru_cache_operations(capacity, operations):