MCPcopy Create free account
hub / github.com/boostorg/compute / insert

Method insert

include/boost/compute/detail/lru_cache.hpp:66–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64 }
65
66 void insert(const key_type &key, const value_type &value)
67 {
68 typename map_type::iterator i = m_map.find(key);
69 if(i == m_map.end()){
70 // insert item into the cache, but first check if it is full
71 if(size() >= m_capacity){
72 // cache is full, evict the least recently used item
73 evict();
74 }
75
76 // insert the new item
77 m_list.push_front(key);
78 m_map[key] = std::make_pair(value, m_list.begin());
79 }
80 }
81
82 boost::optional<value_type> get(const key_type &key)
83 {

Callers 2

add_functionMethod · 0.45
get_global_cacheMethod · 0.45

Calls 4

make_pairFunction · 0.85
findMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected