Beignet API reference
    Preparing search index...

    Function createMemo

    • Wrap an async lookup so calls with the same arguments run once per request.

      Within a memo scope the first call executes and every later call with the same key returns the same value — including the same in-flight promise, so concurrent calls share one execution. Rejected promises are evicted, so a failed lookup is retried by the next call rather than memoized. Outside a scope the function calls through uncached.

      Memoize reads, not mutations. When a mutation in the same infra module makes a memoized read stale, call memoized.invalidate(...) with the read's arguments.

      Type Parameters

      • F extends (...args: never[]) => unknown

      Parameters

      • fn: F

        Function to memoize. this is not forwarded.

      • options: CreateMemoOptions<F> = {}

        Optional name and key builder.

      Returns Memoized<F>

      The function with invalidate(...) and clear() attached.