17 #ifndef QUERYENGINE_CODECACHEACCESSOR_HPP
18 #define QUERYENGINE_CODECACHEACCESSOR_HPP
37 template <
typename CompilationContext>
41 size_t max_cache_size,
51 ,
name_(std::move(name)) {
52 std::ostringstream oss;
56 oss <<
"Initialize a code cache (name: " <<
name_
57 <<
", eviction_metric_type: " << eviction_type
58 <<
", max_cache_size: " << max_cache_size <<
")";
75 return code_cache_.computeNumEntriesToEvict(fraction);
86 os <<
"CodeCacheAccessor<" << c.
name_ <<
">[current size=" << c.
code_cache_.size()
std::shared_ptr< CC > CodeCacheVal
CodeCacheVal< CompilationContext > get_value(const CodeCacheKey &key)
std::mutex code_cache_mutex_
void resetCache(size_t new_max_size)
std::vector< std::string > CodeCacheKey
void evictEntries(const size_t n)
bool put(const CodeCacheKey &key, CodeCacheVal< CompilationContext > &value)
size_t computeNumEntriesToEvict(const float fraction)
EvictionMetricType const eviction_metric_type_
friend std::ostream & operator<<(std::ostream &os, CodeCacheAccessor &c)
void reset(const CodeCacheKey &key, CodeCacheVal< CompilationContext > value)
CodeCacheMetric getCodeCacheMetric()
std::condition_variable compilation_cv_
CodeCache< CompilationContext > code_cache_
CodeCacheAccessor(EvictionMetricType eviction_metric_type, size_t max_cache_size, std::string name)
CodeCacheVal< CompilationContext > * get_or_wait(const CodeCacheKey &key)
void erase(const CodeCacheKey &key)