inline void CertificateCacheTtl::removeAll() { for(Cache::iterator it = m_cache.begin(); it != m_cache.end(); it++) m_scheduler.cancelEvent(it->second.second); m_cache.clear(); }
static void ClearCacheTimer(uv_timer_t *req) { uint64_t now = time(0); Cache::iterator itc = _cache.begin(); while (itc != _cache.end()) { if (itc->second.expire > 0 && itc->second.expire < now) itc->second.clear(0); itc++; } }
/*-------------------------------------------------------------------------*/ void NOMAD::Cache::insert ( Cache & c ) { if ( &c == this ) return; // check the eval types: if ( c._eval_type != _eval_type ) throw NOMAD::Cache::Cache_Error ( "Cache.cpp" , __LINE__ , "NOMAD::Cache:insert(c): c._eval_type != this->_eval_type" ); // insertion: NOMAD::Point bbo_cache , bbo_cur; const NOMAD::Eval_Point * cache_x; const NOMAD::Eval_Point * cur = c.begin(); while ( cur ) { cache_x = find ( *cur ); // the current point is already in cache: if ( cache_x ) { update ( get_modifiable_point ( *cache_x ) , *cur ); delete cur; } // point not in cache: else insert ( *cur ); cur = c.next(); } c._sizeof = static_cast<float> ( sizeof_init() ); c._cache1.clear(); c._cache2.clear(); c._cache3.clear(); c._extern_pts.clear(); }
vector<double> get_Q(int i) { for(vector<double> rows : tempQ) { if(rows[0] == i) { rows.erase(rows.begin()); return rows; } } vector<double> column; column.push_back(i);//id if(tempQ.size() < 1000) { for(int j = 0; j < train_num; j++) { double temp; temp = kernel(trainData[j], trainData[i]); column.push_back(temp); } tempQ.push_back(column); } else { tempQ.erase(tempQ.begin()); for(int j = 0; j < train_num; j++) { double temp; temp = kernel(trainData[j], trainData[i]); column.push_back(temp); } tempQ.push_back(column); } column.erase(column.begin()); return column; }