'use strict';

var angular = require('angular');
require('../modules');
/**
 * 信息发布Detail页面 缓存服务
 */
var module = angular.module('info.services');

module.factory('infoLocalStorageService', function() {

  var service = {

    setInfo: function(infoId, info) {
      var jsonModels = JSON.stringify(info);
      localStorage.setItem('info' + infoId, jsonModels);
    },

    getInfo: function(infoId) {
      return JSON.parse(localStorage.getItem('info' + infoId));
    },

    setMd5: function(infoId, md5) {
      localStorage.setItem('infomd5' + infoId, md5);
    },

    getMd5: function(infoId) {
      return localStorage.getItem('infomd5' + infoId);
    }

  };

  return service;
});