refactor: moved the GC stuff around and corrected all tests
All checks were successful
PR Check / check-and-test (pull_request) Successful in 30s
All checks were successful
PR Check / check-and-test (pull_request) Successful in 30s
This commit is contained in:
@@ -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()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user