generated from nhcarrigan/template
feat: initial app prototype
This commit is contained in:
21
src/modules/updateCache.ts
Normal file
21
src/modules/updateCache.ts
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @copyright nhcarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
import { errorHandler } from "../utils/errorHandler.js";
|
||||
import type { App } from "../interfaces/app.js";
|
||||
|
||||
/**
|
||||
* Updates the cache of sanctions.
|
||||
* @param app - The application instance.
|
||||
*/
|
||||
export const updateCache = async(app: App): Promise<void> => {
|
||||
try {
|
||||
app.cacheUpdated = new Date();
|
||||
// eslint-disable-next-line require-atomic-updates -- We're allowing this so we can update the cache on an interval.
|
||||
app.sanctions = await app.database.sanctions.findMany();
|
||||
} catch (error) {
|
||||
await errorHandler("update cache module", error);
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user