Code Room
Code reviewHardcr-g538
Subject Code reviewLevel Senior–Staff~20 minCommon in Distributed systems interviewsIndustries Software development, Technology

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.

Talk through your review
Code to reviewpython
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.