summaryrefslogtreecommitdiff
path: root/src/cache/dcache_clean_expired.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cache/dcache_clean_expired.c')
-rw-r--r--src/cache/dcache_clean_expired.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/cache/dcache_clean_expired.c b/src/cache/dcache_clean_expired.c
new file mode 100644
index 0000000..0e23443
--- /dev/null
+++ b/src/cache/dcache_clean_expired.c
@@ -0,0 +1,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_t *z, tain 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) ;
+ }
+}