Table of Contents

THttpServerContext.SetLazyItem<T> Method

Registers a factory that lazily produces the value of type T the first time it is requested.

Remarks

The factory (Value) is not called until Item or RequiredItem requests type T and no eager item exists. Once invoked, its result is cached as an eager item, so the factory runs at most once per context.

Syntax

Unit: Sparkle.HttpServer.Context

procedure THttpServerContext.SetLazyItem(const Value: TFunc<T>);

Parameters

<-> Parameter Type Description
const Value TFunc<T>

Type Parameters

Type Parameter Description
T The type used as the key for the value produced by the factory.

See also