Resource leases
Acquire and release
- Register an
IResourceLoader<T>for the resource type. - Load the resource and obtain an
IResourceHandle<T>throughAcquireAsync<T>. - Access the object through
Resourceand dispose the handle when finished. - Use
Retain()to create a separate lease for another component.
The cache identifies resources by requested type and path. The loader handles unloading. Return leases before disposing the manager asynchronously.
Concurrent loads
Concurrent asynchronous requests for the same type and path share one load and receive separate leases. Pass the caller's token to AcquireAsync to cancel that caller's wait. Use the async entry point when a shared load for the same resource is pending.
For engine projects, see load Godot resources.