Skip to content

Commit

Permalink
chore: Remove cache configuration from index.ts and clear cache in Ma…
Browse files Browse the repository at this point in the history
…nager.ts
  • Loading branch information
EvarinDev committed Jul 23, 2024
1 parent fdb312b commit f0c9a26
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
9 changes: 1 addition & 8 deletions example/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions src/structures/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ export class Manager extends TypedEmitter<ManagerEvents> {
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);
}

Expand Down Expand Up @@ -178,7 +177,6 @@ export class Manager extends TypedEmitter<ManagerEvents> {
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
Expand Down Expand Up @@ -240,10 +238,7 @@ export class Manager extends TypedEmitter<ManagerEvents> {
}
}

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) {
Expand Down

0 comments on commit f0c9a26

Please sign in to comment.