refactor: moved the GC stuff around and corrected all tests
All checks were successful
PR Check / check-and-test (pull_request) Successful in 30s

This commit is contained in:
2025-07-13 04:20:12 -05:00
parent 1673e9554a
commit 539f14e8ec
9 changed files with 368 additions and 376 deletions

View File

@@ -80,21 +80,21 @@ func New(address string, memorySize string, memoryMultiplier int, diskSize strin
}
c := cache.New(
cachehandler,
gc.PromotionDecider,
)
var m *memory.MemoryFS
var mgc *gc.GCFS
if memorysize > 0 {
m = memory.New(memorysize)
mgc = gc.New(m, memoryMultiplier, lruGC)
mgc = gc.New(m, memoryMultiplier, gc.LRUGC)
}
var d *disk.DiskFS
var dgc *gc.GCFS
if disksize > 0 {
d = disk.New(diskPath, disksize)
dgc = gc.New(d, diskMultiplier, lruGC)
dgc = gc.New(d, diskMultiplier, gc.LRUGC)
}
// configure the cache to match the specified mode (memory only, disk only, or memory and disk) based on the provided sizes
@@ -154,7 +154,7 @@ func New(address string, memorySize string, memoryMultiplier int, diskSize strin
if d != nil {
if d.Size() > d.Capacity() {
lruGC(d, uint(d.Size()-d.Capacity()))
gc.LRUGC(d, uint(d.Size()-d.Capacity()))
}
}