Please Note, the Queue is always "cached" on the client side, which means it's still quite fast, however, the speed of "saving and syncing" depends on the StoreManager.
Here is a List of External Stores I'd recommend:
DragonflyDB (Redis Remake, but for bigger scale and it's quite faster than redis)
The interface `QueueStoreManager` declares, what methods your custom QueueStore requires!
exportinterfaceQueueStoreManagerextendsRecord<string,any>{/** @async get a Value (MUST RETURN UNPARSED!) */get: (guildId:unknown) =>Promise<any>;/** @async Set a value inside a guildId (MUST BE UNPARSED) */set: (guildId:unknown, value:unknown) =>Promise<any>;/** @async Delete a Database Value based of it's guildId */delete: (guildId:unknown) =>Promise<any>;/** @async Transform the value(s) inside of the QueueStoreManager (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */stringify: (value:unknown) =>Promise<any>;/** @async Parse the saved value back to the Queue (IF YOU DON'T NEED PARSING/STRINGIFY, then just return the value) */parse: (value:unknown) =>Promise<Partial<StoredQueue>>;}
This is also the Default Queue Store, which you can import from lavalink-client!
exportclassmyCustomStoreimplementsQueueStoreManager {private redis:RedisClientType;constructor(redisClient:RedisClientType) {this.redis = redisClient; }asyncget(guildId):Promise<any> {returnawaitthis.redis.get(this.id(guildId)); }asyncset(guildId, stringifiedQueueData):Promise<any> {// await this.delete(guildId); // redis requires you to delete it first;returnawaitthis.redis.set(this.id(guildId), stringifiedQueueData); }asyncdelete(guildId):Promise<any> {returnawaitthis.redis.del(this.id(guildId)); }asyncparse(stringifiedQueueData):Promise<Partial<StoredQueue>> {returnJSON.parse(stringifiedQueueData); }asyncstringify(parsedQueueData):Promise<any> {returnJSON.stringify(parsedQueueData); }// you can add more utils if you need to...privateid(guildId) {return`lavalinkqueue_${guildId}`; // transform the id }}
Example for Redis:
exportclassmyCustomStoreimplementsQueueStoreManager {private redis:RedisClientType;constructor(redisClient:RedisClientType) {this.redis = redisClient; }asyncget(guildId):Promise<any> {returnawaitthis.redis.get(guildId); }asyncset(guildId, stringifiedQueueData):Promise<any> {// await this.delete(guildId); // some redis versions (especially on hset) requires you to delete it first;returnawaitthis.redis.set(guildId, stringifiedQueueData); }asyncdelete(guildId):Promise<any> {returnawaitthis.redis.del(guildId); }asyncparse(stringifiedQueueData):Promise<Partial<StoredQueue>> {returnJSON.parse(stringifiedQueueData); }asyncstringify(parsedQueueData):Promise<any> {returnJSON.stringify(parsedQueueData); }}