Amazon Interview Question

Second one is design a API about how to cache.