use hashmap to speed up lru_cache