Wise interview question

Implement a function mimic a cache.