NASA-AMMOS / 3DTilesRendererJS

Renderer for 3D Tiles in Javascript using three.js
https://nasa-ammos.github.io/3DTilesRendererJS/example/bundle/mars.html
Apache License 2.0
1.62k stars 288 forks source link

LRUCache: Use a shared unload function #44

Open gkjohnson opened 4 years ago

gkjohnson commented 4 years ago

Right now every tile gets its own function created but you should be able to set it per cache object:


const cache = new LRUCache();
cache.unloadCallback = tile => {

  // ...

};
gkjohnson commented 4 years ago

It's important for the callback to know which renderer to call "dispose" on so tiles get cleaned up in the right place. A this field could be added so the callback is fired with a certain scope but this seems low priority.

There are also a ton of other callbacks crated in the request contents function used for promises so the benefits of addressing this is unclear.