cpp implementation of lru cache