Demo showing how to replace a already registered component at ASP.NET Core Dependency Injection and override his behavior without change it.
More about on ASP.NET Core - Adicionando Cache em qualquer componente com Injeção de Dependência - Portuguese only