Code Room
Code reviewHard
Question
Review this read-through / write-through cache wrapper around a user store.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
def get_user(uid): u = cache.get(uid) if u is None: u = db.fetch_user(uid) cache.set(uid, u, ttl=3600) return u def update_user(uid, **fields): db.update_user(uid, **fields) cache.set(uid, db.fetch_user(uid), ttl=3600)Run or narrate your approach, then ask the coach.