You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/utilities/idempotency.md
+22-21
Original file line number
Diff line number
Diff line change
@@ -264,6 +264,28 @@ The output serializer supports any JSON serializable data, **Python Dataclasses*
264
264
2. This function does the following <br><br>**1**. Receives the dictionary saved into the persistent storage <br>**1** Serializes to `OrderOutput` before `@idempotent` returns back to the caller.
265
265
3. This serializer receives both functions so it knows who to call when to serialize to and from dictionary.
266
266
267
+
### Using in-memory cache
268
+
269
+
!!! note "In-memory cache is local to each Lambda execution environment."
270
+
271
+
You can enable caching with the `use_local_cache` parameter in `IdempotencyConfig`. When enabled, you can adjust cache capacity _(256)_ with `local_cache_max_items`.
272
+
273
+
By default, caching is disabled since we don't know how big your response could be in relation to your configured memory size.
???+ tip "Tip: Dealing with always changing payloads"
@@ -750,27 +772,6 @@ This utility will raise an **`IdempotencyAlreadyInProgressError`** exception if
750
772
751
773
This is a locking mechanism for correctness. Since we don't know the result from the first invocation yet, we can't safely allow another concurrent execution.
752
774
753
-
### Using in-memory cache
754
-
755
-
**By default, in-memory local caching is disabled**, since we don't know how much memory you consume per invocation compared to the maximum configured in your Lambda function.
756
-
757
-
???+ note "Note: This in-memory cache is local to each Lambda execution environment"
758
-
This means it will be effective in cases where your function's concurrency is low in comparison to the number of "retry" invocations with the same payload, because cache might be empty.
759
-
760
-
You can enable in-memory caching with the **`use_local_cache`** parameter:
761
-
762
-
=== "Caching idempotent transactions in-memory to prevent multiple calls to storage"
When enabled, the default is to cache a maximum of 256 records in each Lambda execution environment - You can change it with the **`local_cache_max_items`** parameter.
0 commit comments