summaryrefslogtreecommitdiff
path: root/src/caches/dcache_clean_expired.c
blob: 5308d8aea9b6a1564437b9776e3bc97fc2bffaef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* ISC license. */

#include <stdint.h>

#include <skalibs/tai.h>
#include <skalibs/avltree.h>

#include <s6-dns/dcache.h>
#include "dcache-internal.h"

void dcache_clean_expired (dcache_t *z, tain_t const *stamp)
{
  for (;;)
  {
    uint32_t i ;
    if (!avltree_min(&z->by_expire, &i)) break ;
    if (tain_less(stamp, &DNODE(z, i)->expire)) break ;
    dcache_delete(z, i) ;
  }
}