mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-31 09:29:42 +00:00
use arena_pool for cache get
This commit is contained in:
17
src/network/cache/Cache.zig
vendored
17
src/network/cache/Cache.zig
vendored
@@ -28,9 +28,9 @@ kind: union(enum) {
|
||||
fs: FsCache,
|
||||
},
|
||||
|
||||
pub fn get(self: *Cache, allocator: std.mem.Allocator, key: []const u8) ?CachedResponse {
|
||||
pub fn get(self: *Cache, arena: std.mem.Allocator, key: []const u8) ?CachedResponse {
|
||||
return switch (self.kind) {
|
||||
inline else => |*c| c.get(allocator, key),
|
||||
inline else => |*c| c.get(arena, key),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -187,19 +187,6 @@ pub const CachedMetadata = struct {
|
||||
.headers = headers,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn deinit(self: CachedMetadata, allocator: std.mem.Allocator) void {
|
||||
allocator.free(self.url);
|
||||
allocator.free(self.content_type);
|
||||
for (self.headers) |header| {
|
||||
allocator.free(header.name);
|
||||
allocator.free(header.value);
|
||||
}
|
||||
allocator.free(self.headers);
|
||||
if (self.vary) |v| v.deinit(allocator);
|
||||
if (self.etag) |e| allocator.free(e);
|
||||
if (self.last_modified) |lm| allocator.free(lm);
|
||||
}
|
||||
};
|
||||
|
||||
pub const CachedData = union(enum) {
|
||||
|
||||
Reference in New Issue
Block a user