generated from ztimson/template
Auto caching
This commit is contained in:
@@ -160,16 +160,6 @@ export class ZimManager {
|
||||
|
||||
/** Opens a fresh `ZimReader` for a local ZIM, resolved by file path or catalog `name`. Caller must `.close()` it. */
|
||||
async open(fileOrName) {
|
||||
await this.#ensureDir();
|
||||
const file = await this.#resolveFile(fileOrName);
|
||||
return new ZimReader(file, {clusterTTL: this.#clusterTTL}).open();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a cached, persistently-open `ZimReader` for serving requests — avoids
|
||||
* re-opening the file per request. Idle-evicted after `readerTTL` ms of no use.
|
||||
*/
|
||||
async getCached(fileOrName) {
|
||||
await this.#ensureDir();
|
||||
const file = await this.#resolveFile(fileOrName);
|
||||
let entry = this.#readers.get(file);
|
||||
|
||||
Reference in New Issue
Block a user