問題文
A wholesaler's trigger handler caches a price-book lookup in a static Map so that repeated saves in the same request don't re-query it. A reviewer asks what happens when the calling data load allows partial success. What should the developer say about the cache?
選択肢
- It is cleared before each retry attempt, and the handler re-queries the price book every time and the cache brings no benefit to the transaction that is running the code.
- It persists past the end of the request and into the next one from the same user, and the handler must clear it explicitly in a finally block or the next request in the same session will read values that belong to the previous one.
- It survives into the retry attempts of the same call, because static variables the trigger touches are not reset between them, so the cache should hold only reference data that cannot change mid-transaction.
- It survives into the retry attempts of the same call, which is exactly what makes it safe, because the platform guarantees that a value read from a static variable during a retry is refreshed first.