beanc16 / roll-of-darkness-bot

A discord bot for rolling dice in the New World of Darkness, Pokemon Tabletop United, and Curseborne tabletop systems
1 stars 0 forks source link

Make a `/ptu` or `/ptu_admin` subcommand that clears the google sheets API cache #4

Open beanc16 opened 1 day ago

beanc16 commented 1 day ago

Currently, when data is obtained from the Google Sheets Microservice, the CachedGoogleSheetsApiService class will "cache" the data in a runtime variable, which will be retained until the bot restarts. However, there are times where data will be updated in a spreadsheet and we want the bot to be able to use that new data immediately.

There should be a command under /ptu or /ptu_admin (once the command exists) to allow the bot to clear the cache when given a specific key, so that specific data can be cleared without clearing the whole cache. This will allow us to successfully retrieve the new data the next time it's requested.

The below method should clear the cache sufficiently. It just needs called by the new subcommand. https://github.com/beanc16/roll-of-darkness-bot/blob/a9e57c39543301dcce0036b86cc09318c7f52986/src/services/CachedGoogleSheetsApiService.ts#L277-L281