cache: a byte budget of 256 bytes per entry bounds the cached answers, evicting by clock, and a full or failed copy is counted instead of swallowed
This commit is contained in:
@@ -604,13 +604,13 @@ test "S8 case 8: the cache ages a real response and expires it at the boundary"
|
||||
try testing.expectEqual(@as(u32, 300), class.ttl_seconds);
|
||||
try testing.expectEqual(false, class.negative);
|
||||
|
||||
var cache = try dns_cache.DnsCache.init(testing.allocator, .{ .size = 16, .negative_ttl_max = 3600 });
|
||||
var cache = try dns_cache.DnsCache.init(testing.allocator, .sized(16));
|
||||
defer cache.deinit();
|
||||
|
||||
var key_buf: [dns_cache.max_key_len]u8 = undefined;
|
||||
const key = dns_cache.buildKey(&key_buf, "example.com", 1, 1, false, null);
|
||||
|
||||
try cache.put(1000, key, response, class);
|
||||
cache.put(1000, key, response, class);
|
||||
try testing.expectEqual(@as(u32, 1), cache.len());
|
||||
|
||||
var out: [512]u8 = undefined;
|
||||
|
||||
Reference in New Issue
Block a user