Expire all stats keys eventually

This commit is contained in:
MICHAEL JACKSON
2017-05-28 22:41:01 -07:00
parent 1cb6233383
commit bca5babb7d
3 changed files with 79 additions and 29 deletions

View File

@ -58,14 +58,16 @@ const sumTopScores = (keys, n) =>
}, {})
})
const createKey = (...args) => args.join('-')
const createDayKey = (date) =>
`${date.getUTCFullYear()}-${date.getUTCMonth()}-${date.getUTCDate()}`
createKey(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate())
const createHourKey = (date) =>
`${createDayKey(date)}-${date.getUTCHours()}`
createKey(createDayKey(date), date.getUTCHours())
const createMinuteKey = (date) =>
`${createDayKey(date)}-${date.getUTCMinutes()}`
createKey(createHourKey(date), date.getUTCMinutes())
module.exports = {
getKeyValues,