var angular = require('angular'),
  _ = require('jsUtil');

require('../modules');
require('../../../commons/services/CacheService');

angular
  .module('linker.services')
  .factory('FavoriteLinkerCache', FavoriteLinkerCache);
/** @ngInject */
function FavoriteLinkerCache(CacheService) {
  return {
    update: update,
    get: get
  };

  function update(userId, userIds) {
    if(_.isEmpty(userId)) {return;}
    var key = 'favoriteLinker_' + userId;
    CacheService.put(key, userIds);
  }

  function get(userId) {
    if(_.isEmpty(userId)) {return;}
    var key = 'favoriteLinker_' + userId;
    return CacheService.get(key);
  }
}
