3 ms·
There's a general pattern here: * Object wants some asset. * Asset might be in memory in a cache. If so, satisfy request from cache. * If asset is not in cac
by Animats 3y ago
There's a general pattern here:
* Object wants some asset.
* Asset might be in memory in a cache. If so, satisfy request from cache.
* If asset is not in cache, queue up request, possibly on a priority queue that gets re-prioritized. Merge requests for same asset.
* When request reaches front of queue, see if the things that wanted it still want it. Remove dead requests. Discard entire request if all requestors no longer need it.
* Lock against two asset fetches for same asset being performed simultaneously.
* Fetch and preprocess asset
* Check again that asset is still wanted.
* Deliver asset
* Unlock against two asset fetches for same asset.
This is almost generic, except that once level of detail becomes involved, it gets less generic.