songs.js 512 B

12345678910111213141516171819202122232425
  1. 'use strict';
  2. const cache = require('./cache');
  3. const db = require('./db');
  4. const io = require('./io');
  5. const utils = require('./utils');
  6. const async = require('async');
  7. module.exports = {
  8. init: function(cb) {
  9. let _this = this;
  10. db.models.song.find({}, (err, songs) => {
  11. if (!err) {
  12. songs.forEach((song) => {
  13. cache.hset('songs', song._id, cache.schemas.song(song));
  14. });
  15. cb();
  16. }
  17. });
  18. }
  19. //TODO Add way to get song, which adds song to Redis if not in Redis and returns the song
  20. };