on_invalidate
Cached functions accept an `on_invalidate` function, which we failed to add to the type signature. It's rarely used in the files that we have typed, which is why we haven't noticed it before.
@cached
This requires adding a mypy plugin to fiddle with the type signatures a bit.