Skip to content

Commit

Permalink
add uuidCacheTime option
Browse files Browse the repository at this point in the history
  • Loading branch information
Zickles committed Feb 18, 2024
1 parent 069c2c1 commit 1255396
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ class Client extends EventEmitter {
* @typedef {object} ClientOptions
* @prop {boolean} [cache=false] Enable/Disable request caching.
* @prop {number} [cacheTime=60] Amount of time in seconds to cache the requests.
* @prop {number} [uuidCacheTime=600] Amount of time in seconds to cache uuids.
* @prop {CacheHandler} [cacheHandler] Custom Cache Handler
* @prop {AUTO|HARD|NONE} [rateLimit='AUTO'] Rate limit mode.
* @prop {boolean} [syncWithHeaders=false] Sync with headers rate limit information. Usually not necessary nor recommended ( because of latency )
Expand Down
6 changes: 5 additions & 1 deletion src/Private/uuidCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ async function putCache(response) {
try {
response = await response.json();
cachedUuids.set(response.id, response.name);
setTimeout(deleteCache, 1000 * 60 * 10, response.id);
if (this.client.options.uuidCacheTime >= 0) {

Check failure on line 13 in src/Private/uuidCache.js

View workflow job for this annotation

GitHub Actions / es-lint

Unexpected 'this'

Check failure on line 13 in src/Private/uuidCache.js

View workflow job for this annotation

GitHub Actions / es-lint

Unexpected 'this'
setTimeout(deleteCache, this.client.options.uuidCacheTime * 1000, response.id);

Check failure on line 14 in src/Private/uuidCache.js

View workflow job for this annotation

GitHub Actions / es-lint

Unexpected 'this'

Check failure on line 14 in src/Private/uuidCache.js

View workflow job for this annotation

GitHub Actions / es-lint

Unexpected 'this'
} else {
setTimeout(deleteCache, 1000 * 60 * 10, response.id);
}
} catch (e) {
// F
}
Expand Down

0 comments on commit 1255396

Please sign in to comment.