Commit 5723b1cd authored by Marek Vavruša's avatar Marek Vavruša

modules/cachectl: count pruned towards deletes

parent fe6e44fd
......@@ -54,10 +54,11 @@ static bool is_expired(struct kr_cache_entry *entry, uint32_t drift)
static char* prune(void *env, struct kr_module *module, const char *args)
{
struct engine *engine = env;
const namedb_api_t *storage = engine->resolver.cache.api; /* kr_cache_storage(); */
struct kr_cache *cache = &engine->resolver.cache;
const namedb_api_t *storage = cache->api;
struct kr_cache_txn txn;
int ret = kr_cache_txn_begin(&engine->resolver.cache, &txn, 0);
int ret = kr_cache_txn_begin(cache, &txn, 0);
if (ret != 0) {
return NULL;
}
......@@ -77,6 +78,7 @@ static char* prune(void *env, struct kr_module *module, const char *args)
struct kr_cache_entry *entry = val.data;
if (is_expired(entry, now - entry->timestamp)) {
storage->del(&txn.t, &key);
cache->stats.delete += 1;
pruned += 1;
}
it = storage->iter_next(it);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment