bool blockingGet(const K& key, V& value) { size_t index = _hasher(key) % _size; boost::shared_lock<boost::shared_mutex> shared_lock(_mutexs[index]); typename boost::unordered_map<K, V>::iterator it = _maps[index].find(key); if (it == _maps[index].end()) { return false; } value = _maps[index][key]; return true; }
void blockingSet(const K& key, const V& value) { size_t index = _hasher(key) % _size; boost::unique_lock<boost::shared_mutex> unique_lock(_mutexs[index]); _maps[index][key] = value; }
size_t hash(KeyType const &k) const { return _hasher(k) % _values.capacity(); }