1
0
mirror of https://github.com/ltcptgeneral/cs239-caching.git synced 2025-04-01 20:33:26 +00:00

improve tiered cache with return to l1 mechanic

This commit is contained in:
Arthur Lu 2025-02-28 19:21:53 +00:00 committed by root
parent f7903f4fea
commit c3340e037d

@ -21,6 +21,11 @@ class TieredCache(BaselineCache):
f = open(self.l2_map[key], "r")
v = f.read()
f.close()
# we will also preemptively return the value from l1 to l2:
del self.l2_map[key]
self.put(key, v)
return v
else: # otherwise its a cache miss and return None
return None