Skip to content

Commit 3a51528

Browse files
committed
Remove refresh() method from public API surface area.
1 parent 8d05150 commit 3a51528

2 files changed

Lines changed: 2 additions & 25 deletions

File tree

docs/utilities/lambda_metadata.md

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -160,29 +160,6 @@ For [Lambda Managed Instances](https://docs.aws.amazon.com/lambda/latest/dg/lamb
160160
}
161161
```
162162

163-
### Forcing a refresh
164-
165-
In rare cases where you need to force a refresh of the cached metadata, use the `refresh()` method:
166-
167-
=== "RefreshExample.java"
168-
169-
```java hl_lines="10"
170-
import software.amazon.lambda.powertools.metadata.LambdaMetadata;
171-
import software.amazon.lambda.powertools.metadata.LambdaMetadataClient;
172-
173-
public class RefreshExample implements RequestHandler<Object, String> {
174-
175-
@Override
176-
public String handleRequest(Object input, Context context) {
177-
// Force a refresh of the cached metadata
178-
// This makes a new HTTP request to the metadata endpoint
179-
LambdaMetadata metadata = LambdaMetadataClient.refresh();
180-
return "{\"az\": \"" + metadata.getAvailabilityZoneId() + "\"}";
181-
}
182-
}
183-
```
184-
185-
186163
### Error handling
187164

188165
The utility throws `LambdaMetadataException` when the metadata endpoint is unavailable or returns an error:

powertools-lambda-metadata/src/main/java/software/amazon/lambda/powertools/metadata/LambdaMetadataClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ public static LambdaMetadata get() {
114114
* Forces a refresh of the cached metadata.
115115
* <p>
116116
* This method clears the cache and fetches fresh metadata from the endpoint.
117-
* Use this only for advanced use cases where you need to force a refresh.
117+
* Used internally for SnapStart cache invalidation.
118118
* </p>
119119
*
120120
* @return the refreshed LambdaMetadata instance
121121
* @throws LambdaMetadataException if the metadata endpoint is unavailable or returns an error
122122
*/
123-
public static LambdaMetadata refresh() {
123+
static LambdaMetadata refresh() {
124124
cachedInstance.set(null);
125125
return get();
126126
}

0 commit comments

Comments
 (0)