view js/modules/cache.js @ 71:4ec651cc606e

we now only make one request at a time to the bugzilla server, which reduces app responsiveness but makes us less of a douche to the server.
author Atul Varma <avarma@mozilla.com>
date Sun, 25 Apr 2010 17:55:54 -0700
parents 55c1b3647357
children 312d4af344c2
line wrap: on
line source

Require.modules["cache"] = function(exports, require) {
  var window = require("window");
  var cache;

  if (window.localStorage["cache"]) {
    cache = JSON.parse(window.localStorage["cache"]);
  } else
    cache = {};

  exports.set = function set(key, value) {
    cache[key] = value;
    window.localStorage["cache"] = JSON.stringify(cache);
  };
  exports.get = function get(key) {
    return cache[key];
  };
};