diff options
Diffstat (limited to 'src/cache/dcache_delete.c')
-rw-r--r-- | src/cache/dcache_delete.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cache/dcache_delete.c b/src/cache/dcache_delete.c new file mode 100644 index 0000000..92a5fcc --- /dev/null +++ b/src/cache/dcache_delete.c @@ -0,0 +1,19 @@ +/* ISC license. */ + +#include <skalibs/alloc.h> +#include <skalibs/gensetdyn.h> +#include <skalibs/avltree.h> + +#include <shibari/dcache.h> +#include "dcache-internal.h" + +void dcache_delete (dcache_t *z, uint32_t i) +{ + dcache_node_t *y = DNODE(z, i) ; + avltree_delete(&z->by_expire, &y->expire) ; + avltree_delete(&z->by_entry, &y->entry) ; + avltree_delete(&z->by_key, &y->key) ; + alloc_free(y->key.s) ; + z->size -= DCACHE_NODE_OVERHEAD + y->key.len + y->datalen ; + gensetdyn_delete(&z->storage, i) ; +} |