Weblutions Documentation > Product Documentation > Discord Whitelist > Cache Time

Cache Time

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

Setting this value to low could cause you to be rate limited if to many requests are made.

For smaller servers we recommend 1 minute. For large servers with a lot of traffic we recommend 10 minutes.

You can fine tune this setting depending on your incoming server traffic.

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.

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.


Related Articles


Suggest an edit

Review this page

snatchyou

discord cache cachetime cacheMaxTime discord whitelist cache

1 recommend this page