1
0
mirror of https://github.com/ltcptgeneral/cs239-caching.git synced 2025-08-14 05:10:20 +00:00

add individual config files for each strategy,

config file path can be specified as the second argument
This commit is contained in:
Arthur Lu
2025-02-28 19:17:44 +00:00
committed by root
parent e9b1128826
commit f7903f4fea
6 changed files with 18 additions and 1 deletions

@ -11,12 +11,16 @@ app = FastAPI()
# Initialize cache based on strategy from config.yaml or environment variable
if CACHE_STRATEGY == "Baseline":
print("Using baseline cache strategy")
cache = BaselineCache(limit=CACHE_LIMIT)
elif CACHE_STRATEGY == "Prefetch":
print("Using prefetch cache strategy")
cache = PrefetchCache(limit=CACHE_LIMIT)
elif CACHE_STRATEGY == "Tiered":
print("Using tiered cache strategy")
cache = TieredCache(limit=CACHE_LIMIT, l2_limit=L2_CACHE_LIMIT)
elif CACHE_STRATEGY == "Seive":
print("Using seive cache strategy")
cache = SeiveCache(limit=CACHE_LIMIT)
else:
raise ValueError(f"Invalid CACHE_STRATEGY: {CACHE_STRATEGY}")