Amazon interview question

Second one is design a API about how to cache.