mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-31 09:29:42 +00:00
use CacheRequest instead of key
This commit is contained in:
12
src/network/cache/Cache.zig
vendored
12
src/network/cache/Cache.zig
vendored
@@ -28,15 +28,15 @@ kind: union(enum) {
|
||||
fs: FsCache,
|
||||
},
|
||||
|
||||
pub fn get(self: *Cache, arena: std.mem.Allocator, key: []const u8) ?CachedResponse {
|
||||
pub fn get(self: *Cache, arena: std.mem.Allocator, req: CacheRequest) ?CachedResponse {
|
||||
return switch (self.kind) {
|
||||
inline else => |*c| c.get(arena, key),
|
||||
inline else => |*c| c.get(arena, req),
|
||||
};
|
||||
}
|
||||
|
||||
pub fn put(self: *Cache, key: []const u8, metadata: CachedMetadata, body: []const u8) !void {
|
||||
pub fn put(self: *Cache, req: CacheRequest, metadata: CachedMetadata, body: []const u8) !void {
|
||||
return switch (self.kind) {
|
||||
inline else => |*c| c.put(key, metadata, body),
|
||||
inline else => |*c| c.put(req, metadata, body),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -189,6 +189,10 @@ pub const CachedMetadata = struct {
|
||||
}
|
||||
};
|
||||
|
||||
pub const CacheRequest = struct {
|
||||
url: []const u8,
|
||||
};
|
||||
|
||||
pub const CachedData = union(enum) {
|
||||
buffer: []const u8,
|
||||
file: std.fs.File,
|
||||
|
||||
Reference in New Issue
Block a user