summaryrefslogtreecommitdiff
path: root/src/libdcache/dcache_clean_expired.c
blob: d81bec8997dce46ad2121c0d15fb1b2f552c6899 (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 <shibari/dcache.h>
#include "dcache-internal.h"

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