Natsuki's API! https://api.natsuki.app
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
api/api/util/startup/cache.js

26 lines
722 B

const gs = require('gradient-string');
const spinnies = require('dreidels');
const chalk = require('chalk');
module.exports = async app => {
app.cache = {
users: {},
series: {},
seriesCount: 0
};
return new Promise(async resolve => {
const loaders = [];
const spin = new spinnies();
let userCache = spin.add("ar", {text: "Caching Users..."});
loaders.push(require('./cache/users')(app, userCache));
let seriesCache = spin.add("ar", {text: "Caching Series..."});
loaders.push(require('./cache/series')(app, seriesCache));
await Promise.all(loaders);
console.log('');
resolve(0);
});
}; //robbery is cool :)