-
Notifications
You must be signed in to change notification settings - Fork 162
Closed
Labels
completedThis item is complete and has been merged/shippedThis item is complete and has been merged/shippedfeature-requestThis item refers to a feature request for an existing or new utilityThis item refers to a feature request for an existing or new utilityparametersThis item relates to the Parameters UtilityThis item relates to the Parameters Utility
Milestone
Description
Use case
When testing code that uses the Parameters utility, and specifically some of the high-order functions like getParameter
or getAppConfig
, it's important that users have the ability to control cache eviction.
Right now users can manually import the DEFAULT_PROVIDERS
object and manually clean the cache of each provider, i.e.:
import { DEFAULT_PROVIDERS } from '@aws-lambda-powertools/parameters';
for (const provider of Object.values(DEFAULT_PROVIDERS)) {
provider.clearCache();
}
This however results in unnecessary boilerplate code. There is an opportunity to provide a better DX by exposing a clearCaches
helper function that incapsulate this code as well as any future underlying logic required to clean cache.
Solution/User Experience
import { clearCaches } from '@aws-lambda-powertools/parameters';
clearCaches();
The function will iterate the DEFAULT_PROVIDERS
and call the clearCache
method on each one.
Alternative solutions
N/A
Acknowledgment
- This feature request meets Lambda Powertools Tenets
- Should this be considered in other Lambda Powertools languages? i.e. Python, Java, and .NET
Future readers
Please react with 👍 and your use case to help us understand customer demand.
Metadata
Metadata
Assignees
Labels
completedThis item is complete and has been merged/shippedThis item is complete and has been merged/shippedfeature-requestThis item refers to a feature request for an existing or new utilityThis item refers to a feature request for an existing or new utilityparametersThis item relates to the Parameters UtilityThis item relates to the Parameters Utility