42 if (m_cache.size() >= c_maxSize)
43 removeRandomElement();
44 m_cache[_hash] = size;
49 return m_cache.count(_hash);
51 size_t get(
h256 const& _hash)
const 54 return m_cache.at(_hash);
61 void removeRandomElement()
66 if (it == m_cache.end())
72 static const size_t c_maxSize = 50000;
73 mutable Mutex x_cache;
74 std::map<h256, size_t> m_cache;
std::unique_lock< std::mutex > UniqueGuard
void store(h256 const &_hash, size_t size)
Simple thread-safe cache to store a mapping from code hash to code size. If the cache is full...
bool contains(h256 const &_hash) const
static FixedHash random()
static CodeSizeCache & instance()