GitHub

layer_ref

API reference for layer_ref.

LayerRef[I, E]: a layer built on first use and shared while in use.

The built services are cached in an RcRef: context_effect() (or building the get() layer) builds the layer once and holds it until the caller's scope closes, and the last holder releases it, at once or after idle_time_to_live. invalidate() forgets the build so the next use rebuilds; refresh() also rebuilds now. preload=True builds when the ref is made, and invalidation_schedule invalidates (with preload, refreshes) each time it recurs.

LayerRefService[I, E] is a tag for a LayerRef: subclass it, build it with layer(...), and use get(), context_effect(), invalidate() and refresh() through the tag.

Classes