tauri-app/src/lib/player/chunk-cache.ts
2024-02-11 18:12:40 +01:00

21 lines
341 B
TypeScript

import Chunk from "./chunk";
class ChunkCache {
private cache = new Map<number, ArrayBuffer>();
get(index: number) {
return this.cache.get(index);
}
set(chunk: Chunk) {
this.cache.set(chunk.getIndex(), chunk.getBuffer());
}
clear() {
this.cache.clear();
}
}
const chunkCache = new ChunkCache();
export default chunkCache;