Complete the code to define the first level cache type.
cache = [1]Cache() # First level cache for fastest access
The first level cache is usually an in-memory cache for fastest data retrieval.
Complete the code to define the second level cache type.
cache = [1]Cache() # Second level cache for larger but slower storage
The second level cache is often disk-based to hold more data but slower than memory.
Fix the error in the cache eviction policy assignment.
cache.eviction_policy = '[1]' # Set eviction policy to remove least recently used items
LRU (Least Recently Used) is a common eviction policy for caches to remove old data.
Fill both blanks to complete the multi-level cache lookup logic.
if [1] in L1_cache: return L1_cache[[2]]
We check if the key is in the first level cache and return the value by the same key.
Fill all three blanks to complete the cache update after a miss.
if key not in L1_cache: data = [1].get(key) L2_cache.[2](key, data) L1_cache.[3](key, data)
On a cache miss, data is fetched from the database, then stored in L2 and L1 caches using put and set methods respectively.
