augustoasilva commented on a change in pull request #11193: URL: https://github.com/apache/arrow/pull/11193#discussion_r713840353
########## File path: cpp/src/gandiva/greedy_dual_size_cache.h ########## @@ -146,9 +159,25 @@ class GreedyDualSizeCache { priority_set_.erase(i); } + void evictObject() { + // TODO: inflation overflow is unlikely to happen but needs to be handled + // for correctness. + // evict item from the beginning of the set. This set is ordered from the + // lower priority value to the higher priority value. + typename std::set<PriorityItem>::iterator i = priority_set_.begin(); + // update the inflation cost related to the evicted item + inflation_ = (*i).actual_priority; + size_t size_to_decrease = map_.find((*i).cache_key)->second.first.size; + cache_size_ -= size_to_decrease; + map_.erase((*i).cache_key); + priority_set_.erase(i); + } + map_type map_; std::set<PriorityItem> priority_set_; uint64_t inflation_; size_t capacity_; + size_t cache_size_ = 0; + llvm::SmallString<128> cache_dir_; Review comment: Removed it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org