Explore Library
Code QuizAdvanced

Caching Expensive Pipeline Steps

Spot why the cache returns stale results for new inputs.

Codepython
cache = {}

def run_step(step_name, data):
    if step_name in cache:
        return cache[step_name]
    result = expensive_transform(data)
    cache[step_name] = result
    return result

What is the bug in this pipeline caching logic?