if maxcount or callback
then error('cache.clear(): maxcount and callback parameters not supported with rr_type') end
local ret = ffi.C.kr_cache_remove(kres.context().cache, dname, rr_type)
- if ret ~= 0 then error(ffi.string(ffi.C.knot_strerror(ret))) end
+ if ret < 0 then error(ffi.string(ffi.C.knot_strerror(ret))) end
return true
end
if maxcount == nil then maxcount = 100 end
if (ret) return kr_error(ret);
knot_db_val_t key = key_exact_type(k, type);
- return cache_op(cache, remove, &key, 1);
+ ret = cache_op(cache, remove, &key, 1);
+ switch (ret) {
+ case 0: return 1;
+ case -ABS(ENOENT): return 0;
+ default: return ret;
+ }
+
}
int kr_cache_match(struct kr_cache *cache, const knot_dname_t *name,
* @param cache cache structure
* @param name dname
* @param type rr type
- * @return 0 or an errcode
+ * @return number of deleted records, or negative error code
* @note only "exact hits" are considered ATM, and
* some other information may be removed alongside.
*/