Port of lru cache.