WhileUsed
Parameters
Defines a retention period in milliseconds in which to still keep the value in RAM although the reference count returned to 0. If the value is requested again within this retention period, the old value is reused. Defaults to 0 (immediately frees the value).
Optional destructor which can clean up the object before it gets freed. Defaults to null
in which case, if the value is a Disposable, its dispose()
method is called. Pass an empty lambda function if you don't want this behavior.
Should create and return the value. The builder gets a DisposableGroup as its argument for retrieving other WhileUsed values or for adding other Disposables which must be cleaned up together with this value (as an alternative to using destructor).