UNPKG

lilybird

Version:
48 lines (47 loc) 1.13 kB
export class CachingManager { guilds = new Map(); channels = new Map(); voiceStates = new Map(); set(type, id, payload) { switch (type) { case 0: { this.guilds.set(id, payload); break; } case 1: { this.channels.set(id, payload); break; } case 2: { this.voiceStates.set(id, payload); break; } } } get(type, id) { switch (type) { case 0: { return this.guilds.get(id); } case 1: { return this.channels.get(id); } case 2: { return this.voiceStates.get(id); } } } delete(type, id) { switch (type) { case 0: { return this.guilds.delete(id); } case 1: { return this.channels.delete(id); } case 2: { return this.voiceStates.delete(id); } } } }