Originally published at recca0120.github.io

Ask AI to add caching to your code, and it will. The result looks clean — cache logic extracted into a separate class, business logic untouched. But look closer at your UserService or OrderRepository, and you'll find a new cache dependency, a few extra lines of if/else, and a full "check cache, miss DB, write back" flow baked right in.

The cache logic moved, but it crawled back in through a dependency and stuck to your business logic anyway.

What AI Typically Produces: Cache Embedded in the Service

Say you have a UserRepository and ask AI to add caching. The most common output looks like this: