Lines Matching refs:cache

1003         cache = std::make_unique<Cache>();  in NetConfig()
1025 std::unique_ptr<Cache> cache; member
1054 static bool cache_has_pending_request_locked(Cache* cache, const Entry* key, in cache_has_pending_request_locked() argument
1056 if (!cache || !key) return false; in cache_has_pending_request_locked()
1058 Cache::pending_req_info* ri = cache->pending_requests.next; in cache_has_pending_request_locked()
1059 Cache::pending_req_info* prev = &cache->pending_requests; in cache_has_pending_request_locked()
1079 static void cache_notify_waiting_tid_locked(struct Cache* cache, const Entry* key) { in cache_notify_waiting_tid_locked() argument
1080 if (!cache || !key) return; in cache_notify_waiting_tid_locked()
1082 Cache::pending_req_info* ri = cache->pending_requests.next; in cache_notify_waiting_tid_locked()
1083 Cache::pending_req_info* prev = &cache->pending_requests; in cache_notify_waiting_tid_locked()
1108 Cache* cache = find_named_cache_locked(netid); in _resolv_cache_query_failed() local
1110 if (cache) { in _resolv_cache_query_failed()
1111 cache_notify_waiting_tid_locked(cache, key); in _resolv_cache_query_failed()
1115 static void cache_dump_mru_locked(Cache* cache) { in cache_dump_mru_locked() argument
1118 StringAppendF(&buf, "MRU LIST (%2d): ", cache->num_entries); in cache_dump_mru_locked()
1119 for (Entry* e = cache->mru_list.mru_next; e != &cache->mru_list; e = e->mru_next) { in cache_dump_mru_locked()
1140 static Entry** _cache_lookup_p(Cache* cache, Entry* key) { in _cache_lookup_p() argument
1142 Entry** pnode = (Entry**) &cache->entries[index]; in _cache_lookup_p()
1161 static void _cache_add_p(Cache* cache, Entry** lookup, Entry* e) { in _cache_add_p() argument
1163 e->id = ++cache->last_id; in _cache_add_p()
1164 entry_mru_add(e, &cache->mru_list); in _cache_add_p()
1165 cache->num_entries += 1; in _cache_add_p()
1167 LOG(INFO) << __func__ << ": entry " << e->id << " added (count=" << cache->num_entries << ")"; in _cache_add_p()
1174 static void _cache_remove_p(Cache* cache, Entry** lookup) { in _cache_remove_p() argument
1177 LOG(INFO) << __func__ << ": entry " << e->id << " removed (count=" << cache->num_entries - 1 in _cache_remove_p()
1183 cache->num_entries -= 1; in _cache_remove_p()
1188 static void _cache_remove_oldest(Cache* cache) { in _cache_remove_oldest() argument
1189 Entry* oldest = cache->mru_list.mru_prev; in _cache_remove_oldest()
1190 Entry** lookup = _cache_lookup_p(cache, oldest); in _cache_remove_oldest()
1198 _cache_remove_p(cache, lookup); in _cache_remove_oldest()
1203 static void _cache_remove_expired(Cache* cache) { in _cache_remove_expired() argument
1207 for (e = cache->mru_list.mru_next; e != &cache->mru_list;) { in _cache_remove_expired()
1210 Entry** lookup = _cache_lookup_p(cache, e); in _cache_remove_expired()
1216 _cache_remove_p(cache, lookup); in _cache_remove_expired()
1252 Cache* cache = find_named_cache_locked(netid); in resolv_cache_lookup() local
1253 if (cache == nullptr) { in resolv_cache_lookup()
1260 lookup = _cache_lookup_p(cache, &key); in resolv_cache_lookup()
1266 if (!cache_has_pending_request_locked(cache, &key, true)) { in resolv_cache_lookup()
1275 [netid, &cache, &key]() REQUIRES(cache_mutex) { in resolv_cache_lookup()
1277 cache = find_named_cache_locked(netid); in resolv_cache_lookup()
1278 return !cache_has_pending_request_locked(cache, &key, false); in resolv_cache_lookup()
1280 if (!cache) { in resolv_cache_lookup()
1289 lookup = _cache_lookup_p(cache, &key); in resolv_cache_lookup()
1303 _cache_remove_p(cache, lookup); in resolv_cache_lookup()
1317 if (e != cache->mru_list.mru_next) { in resolv_cache_lookup()
1319 entry_mru_add(e, &cache->mru_list); in resolv_cache_lookup()
1332 Cache* cache = NULL; in resolv_cache_add() local
1343 cache = find_named_cache_locked(netid); in resolv_cache_add()
1344 if (cache == nullptr) { in resolv_cache_add()
1348 lookup = _cache_lookup_p(cache, key); in resolv_cache_add()
1354 cache_notify_waiting_tid_locked(cache, key); in resolv_cache_add()
1358 if (cache->num_entries >= CONFIG_MAX_ENTRIES) { in resolv_cache_add()
1359 _cache_remove_expired(cache); in resolv_cache_add()
1360 if (cache->num_entries >= CONFIG_MAX_ENTRIES) { in resolv_cache_add()
1361 _cache_remove_oldest(cache); in resolv_cache_add()
1364 lookup = _cache_lookup_p(cache, key); in resolv_cache_add()
1368 cache_notify_waiting_tid_locked(cache, key); in resolv_cache_add()
1378 _cache_add_p(cache, lookup, e); in resolv_cache_add()
1382 cache_dump_mru_locked(cache); in resolv_cache_add()
1383 cache_notify_waiting_tid_locked(cache, key); in resolv_cache_add()
1401 Cache* cache = nullptr; in resolv_gethostbyaddr_from_cache() local
1414 cache = find_named_cache_locked(netid); in resolv_gethostbyaddr_from_cache()
1415 if (cache == nullptr) { in resolv_gethostbyaddr_from_cache()
1419 for (node = cache->mru_list.mru_next; node != nullptr && node != &cache->mru_list; in resolv_gethostbyaddr_from_cache()
1511 netconfig->cache->flush(); in resolv_flush_cache_for_net()
1530 if (info != nullptr) return info->cache.get(); in find_named_cache_locked()
1892 Cache* cache; in resolv_cache_get_expiration() local
1894 if (cache = find_named_cache_locked(netid); cache == nullptr) { in resolv_cache_get_expiration()
1898 Entry** lookup = _cache_lookup_p(cache, &key); in resolv_cache_get_expiration()