Lines Matching defs:cache
31 ares__htable_strvp_t *cache;
130 static void ares__qcache_expire(ares__qcache_t *cache,
135 if (cache == NULL) {
139 while ((node = ares__slist_node_first(cache->expire)) != NULL) {
145 ares__htable_strvp_remove(cache->cache, entry->key);
150 void ares__qcache_flush(ares__qcache_t *cache)
154 ares__qcache_expire(cache, &now);
157 void ares__qcache_destroy(ares__qcache_t *cache)
159 if (cache == NULL) {
163 ares__htable_strvp_destroy(cache->cache);
164 ares__slist_destroy(cache->expire);
165 ares_free(cache);
201 ares__qcache_t *cache;
203 cache = ares_malloc_zero(sizeof(*cache));
204 if (cache == NULL) {
209 cache->cache = ares__htable_strvp_create(NULL);
210 if (cache->cache == NULL) {
215 cache->expire = ares__slist_create(rand_state, ares__qcache_entry_sort_cb,
217 if (cache->expire == NULL) {
222 cache->max_ttl = max_ttl;
227 ares__qcache_destroy(cache);
231 *cache_out = cache;
341 /* Don't cache something that is already expired */
362 * want to cache it */
368 if (!ares__htable_strvp_insert(qcache->cache, entry->key, entry)) {
380 ares__htable_strvp_remove(qcache->cache, entry->key);
408 entry = ares__htable_strvp_get_direct(qcache->cache, key);