mirror of
https://github.com/ltcptgeneral/cs239-caching.git
synced 2026-02-03 06:31:02 +00:00
add get user id endpoint (/users),
fix issue in tiered cache, update basic test with new user id set
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from fastapi import FastAPI, HTTPException
|
||||
from database import get_user_profile, update_user_profile
|
||||
from database import get_user_ids, get_user_profile, update_user_profile
|
||||
from cache.cache import BaselineCache
|
||||
from cache.prefetch_cache import PrefetchCache
|
||||
from cache.tiered_cache import TieredCache
|
||||
@@ -21,6 +21,10 @@ elif CACHE_STRATEGY == "Seive":
|
||||
else:
|
||||
raise ValueError(f"Invalid CACHE_STRATEGY: {CACHE_STRATEGY}")
|
||||
|
||||
@app.get("/users")
|
||||
def fetch_user_ids():
|
||||
return {"ids": get_user_ids()}
|
||||
|
||||
@app.get("/user/{user_id}")
|
||||
def fetch_user_profile(user_id: str):
|
||||
"""Fetch user profile with caching"""
|
||||
|
||||
Reference in New Issue
Block a user