Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Add cache times to credentials.json#2277

Merged
Shiiyu merged 6 commits intoSkyCryptWebsite:developmentfrom
ptlthg:feat/configurable_cache_times
Sep 26, 2024
Merged

Add cache times to credentials.json#2277
Shiiyu merged 6 commits intoSkyCryptWebsite:developmentfrom
ptlthg:feat/configurable_cache_times

Conversation

@ptlthg
Copy link
Copy Markdown
Contributor

@ptlthg ptlthg commented Sep 25, 2024

Adds configurable cache times (in seconds) to the credentials file.

While I don't really think the credentials file is a great place for this, there's not really a better spot and this functionality definitely needed to go somewhere.

I also added a cachetimes.js file which exports helper functions to check if a cache on a specific resource is expired. These functions are then used to make the cache checks in lib.js much easier to understand.

Default cache times might want to be changed, there were some very confusing checks that I replaced with this PR, so make sure to double-check those.

Right now they're defined in the credentials file like this:

cacheSeconds: {
  profiles: 60 * 5, // 5 minutes
  bingoProfile: 60 * 5, // 5 minutes
  museum: 60 * 30, // 30 minutes
  guild: 60 * 60 * 24, // 24 hours
},

@Shiiyu Shiiyu self-requested a review September 26, 2024 04:49
Copy link
Copy Markdown
Member

@Shiiyu Shiiyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, yet to test, will do tomorrow

@Shiiyu Shiiyu merged commit 57d6d1a into SkyCryptWebsite:development Sep 26, 2024
@ptlthg ptlthg deleted the feat/configurable_cache_times branch September 26, 2024 21:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants