createCachedFn
function wraps any function fn in a cache that is scoped to the current “event” (via getEvent()), ensuring repeat calls with the same arguments during that event return cached results instead of recomputing.
Summary: • Caches function results per event. • Uses fn.toString() and JSON.stringify(args) as cache keys. • Stores cache in a per-event __cachedStorage map. • Avoids recomputation for repeated calls with the same arguments during the same event.
It’s ideal for optimizing repeated pure function calls during a single request or lifecycle event.