summaryrefslogtreecommitdiff
path: root/src/libdcache/dcache_clean_expired.c
blob: 7109e5cb179c339b5b4e5eb98ceb2c21312ef1d7 (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(&DNODE(z, i)->expire, stamp)) break ;
    dcache_delete(z, i) ;
  }
}