From f0c9a2625f83e4b065d70855aa0e9f93413d5a64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?FAY=E3=82=B7?= <103030954+FAYStarNext@users.noreply.github.com> Date: Tue, 23 Jul 2024 19:12:55 +0700 Subject: [PATCH] chore: Remove cache configuration from index.ts and clear cache in Manager.ts --- example/src/index.ts | 9 +-------- src/structures/Manager.ts | 5 ----- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/example/src/index.ts b/example/src/index.ts index 07d9585..0af0475 100644 --- a/example/src/index.ts +++ b/example/src/index.ts @@ -20,10 +20,6 @@ let manager = new Manager({ resumeStatus: true, }, ], - cache: { - enable: true, - time: 60000, - }, clientId: "1234567890", send(guild_id, payload) { const guild = client.guilds.cache.get(guild_id); @@ -55,10 +51,7 @@ client.on("messageCreate", async (message) => { let end; try { // Search for tracks using a query or url, using a query searches youtube automatically and the track requester object - res = await manager.search({ - query: search, - cache: true, - }); + res = await manager.search({query: search}); end = `Time took: ${Math.round(performance.now() - start)}ms.`; // Check the load type as this command is not that advanced for basics if (res.loadType === 'empty') throw res; diff --git a/src/structures/Manager.ts b/src/structures/Manager.ts index 92fa693..537b64a 100644 --- a/src/structures/Manager.ts +++ b/src/structures/Manager.ts @@ -137,7 +137,6 @@ export class Manager extends TypedEmitter { if (this.options.nodes) this.options.nodes.forEach((nodeOptions) => { return new (Structure.get("Node"))(nodeOptions); }); setInterval(() => { this.search_cache.clear(); - console.log("Cache cleared."); }, this.options.cache?.time || 10000); } @@ -178,7 +177,6 @@ export class Manager extends TypedEmitter { let search = _query.query; if (!/^https?:\/\//.test(search)) search = `${_source}:${search}`; - console.log(await this.search_cache.get(String(search))) if (this.search_cache.get(String(search))) { let data = await this.search_cache.get(String(search)) return data @@ -240,10 +238,7 @@ export class Manager extends TypedEmitter { } } - console.log(this.CheckURL(String(search))) if (res.loadType === "search") await this.search_cache.set(String(search), result); - console.log(String(search)) - console.log(await this.search_cache.get(String(search))) return result; } catch (err) {