# HG changeset patch # User Atul Varma # Date 1272211846 25200 # Node ID 55c1b364735770cd7d0a37bfdd2016ddfff00497 # Parent 8294f3d1efee37edb08d2ea6ffb1a8f2819dce3e cache now uses localstorage diff -r 8294f3d1efee -r 55c1b3647357 js/modules/cache.js --- a/js/modules/cache.js Sun Apr 25 08:52:28 2010 -0700 +++ b/js/modules/cache.js Sun Apr 25 09:10:46 2010 -0700 @@ -1,8 +1,15 @@ -Require.modules["cache"] = function(exports) { - var cache = {}; +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];