Merge branch 'master' into 147-add-cache-for-gettopusers

This commit is contained in:
Ajay Ramachandran
2020-10-14 18:35:15 -04:00
committed by GitHub
23 changed files with 941 additions and 21 deletions

View File

@@ -0,0 +1,7 @@
const getHash = require('./getHash.js');
module.exports = function getSubmissionUUID(videoID, category, userID,
startTime, endTime) {
return getHash('v2-categories' + videoID + startTime + endTime + category +
userID, 1);
};

View File

@@ -19,6 +19,11 @@ if (config.mode === "test") {
// YouTubeAPI.videos.list wrapper with cacheing
exportObject.listVideos = (videoID, part, callback) => {
if (videoID.length !== 11 || videoID.includes(".")) {
callback("Invalid video ID");
return;
}
let redisKey = "youtube.video." + videoID + "." + part;
redis.get(redisKey, (getErr, result) => {
if (getErr || !result) {