He can walk
DIAdiscord.js - Imagine an app
•Created by He can walk on 6/27/2024 in #djs-questions
Questions about Discord.js cache
Hello.
I had sent a friend to write a question about Discord.js as I'm very busy.
He has been banned, and I don't understand why.
So I'm going to ask the same question again, but in my own words.
Some developers I know have complained about the Discord.js cache. Personally, I haven't had any problems with it yet, but I'm a bit apprehensive. One of the things I've heard is that it takes up a lot of RAM as a bot scales.
One dev that I know also complained a bit about shelters, saying that they can be a bit tricky.
But, still, I'm not particularly shocked by all this.
The question I'm wondering about is whether the cache ends up with duplicate entries or not, or whether it would simply be possible to limit the amount of information cached in-memory and, once a certain threshold has been reached, send it to a Redis cache?
This kind of optimisation could be implemented almost for-free. I'm not asking for it to be done tomorrow, or even for it to be done at all.
I'd simply sent my friend to ask you whether you knew Bentocache (made by one of the AdonisJS core team member), and what you thought of it in relation to your considerations about Discord.js's cache?
Historically, it doesn't seem to me that there's really any other lib that exists to be able to drive different caching technologies like Bentocache does. In fact, that's what its author told me about his motivation for writing it and making it open source.
I completely understand why Discord.js has its own in-house caching solution, given that pretty much the whole JS ecosystem is playing the same game, which is precisely what Bentocache is trying to solve.
I would therefore like to know, in all transparency, if you are having problems with duplicate data in your cache. For example: how you go about sharing cache information between shards (which are separate processes and cannot therefore share in-memory context with each other except via a distributed cache such as Redis or DragonflyDB?).
75 replies