Closed yhakbar closed 4 weeks ago
An interesting observation made was that we generally are looking for caching to support memoization of our function calls.
Leveraging a OnceFunc with something to old the functions for re-use might provide a good pattern for a large scale refactor.
@denis256 did some refactoring within https://github.com/gruntwork-io/terragrunt/pull/3307 to pass in cache by context instead of a global cache, so we can consider this work done.
In the future, we may want to revisit this and refactor further to avoid storing the cache in the ctx
parameter, etc.
We rely on global variables for shared cache state, which is an anti-pattern we should refactor out of the codebase.
This can cause issues with integration testing, and can increase the memory footprint of Terragrunt.
Develop a new mechanism for explicitly passing around that cache through a cache manager so that we can be more thoughtful with how we're caching content throughout an invocation of Terragrunt. Refactor caching throughout the codebase to leverage it.