srctree

Gregory Mullen parent 01bf42c3 987d6f9c
code to make cache eaiser to use 'in the future'

src/cache.zig added: 12, removed: 4, total 8
@@ -1,6 +1,3 @@
const std = @import("std");
const Allocator = std.mem.Allocator;
 
pub const Cache = @This();
 
alloc: Allocator,
@@ -11,6 +8,13 @@ alloc: Allocator,
// commit_flex: COMMIT_FLEX,
//},
 
/// Basically a thin wrapper around StringHashMap
pub fn Cacher(T: type) type {
return struct {
cache: StringHashMap(T),
};
}
 
const COMMIT_FLEX = @import("endpoints/commit-flex.zig");
pub fn init(a: Allocator) !Cache {
COMMIT_FLEX.initCache(a);
@@ -22,3 +26,7 @@ pub fn init(a: Allocator) !Cache {
pub fn raze(c: Cache) void {
COMMIT_FLEX.razeCache(c.alloc);
}
 
const std = @import("std");
const Allocator = std.mem.Allocator;
const StringHashMap = std.StringHashMap;