Weblutions Documentation
Weblutions Main Site Contact Us Our Discord
Some pages are still pending proper formatting, if required refer to the legacy documentation website.
FiveM Documentation IconFiveM Documentation

Weblutions Documentation / FiveM Documentation / Discord Whitelist Cache

Updated

Discord Whitelist Cache

By Josh M. 1 mins 2

Discord Whitelist has a built in cache system to allow your attached bot to not get rate limited. Without this Discord Whitelist will be rate limited and will not allow anyone to join your FiveM/RedM server.

In the server.js file you'll find the config option:

var cacheMaxTime = "2m";

This setting sets the expiry for the built in cache.

Values possible with cacheMaxTime. Add the below option as a suffix (after) the number you set.

  • s = seconds, eg; 50s is fifty seconds

  • m = minutes, eg; 2m is two minutes

  • h = hours, eg; 5h is five hours

  • d = days, eg 1d is one day

It is generally recommended to not have this setting below 1 minute as Discord may rate limit the application. If Discord rate limits requests, the resource will be blocked for 24 hours.

For smaller servers we recommend 2 minutes (2m).

For large servers with a lot of traffic we recommend 10 minutes (10m).

How Does it Work?

When a user first tries to connect to your server a request to Discord is made to fetch the users roles. These roles are stored in the built in cache to be referenced later on as needed by the resource.

If the user tries connecting again Discord Whitelist will check the cache to see if the user exists, this means in some cases the roles might not be up to date. This cache is stored for the time set in cacheMaxTime, after this amount of time it is removed from the built in cache - making the user not exist in the cache.

If the user doesn't exist another request is made to Discord again for updated information.