@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.04 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import"../../../core/has.js";const t=5;class e{constructor(){this._storage=new Map,this._purgeInterval=t,this._sweep=()=>{if(this._timer=void 0,!this._storage)return;const t=1e3*this._purgeInterval,e=performance.now()-t;for(const[s,r]of this._storage){if(!(r.time<e))return void(this._storage.size>0&&(this._timer=setTimeout(this._sweep,t)));this._storage.delete(s)}}}destroy(){this._storage?.clear(),this._storage=null,clearTimeout(this._timer)}put(t,e){this._storage?.set(t,new r(e)),this._scheduleSweep()}get(t){const e=this._storage?.get(t);if(e)return this._storage?.delete(t),e.time=performance.now(),this._storage?.set(t,e),e.items}clear(){this._storage?.clear()}_scheduleSweep(){this._storage&&(this._timer??=setTimeout(this._sweep,1e3*this._purgeInterval))}get test(){}}let s=0;class r{constructor(t){this.items=t,this.time=performance.now(),this.id=s++}}export{e as QueryEngineCache};