Mercurial > bugzilla-dashboard
comparison js/modules/cache.js @ 66:55c1b3647357
cache now uses localstorage
author | Atul Varma <avarma@mozilla.com> |
---|---|
date | Sun, 25 Apr 2010 09:10:46 -0700 |
parents | 0b71df72ebe1 |
children | 312d4af344c2 |
comparison
equal
deleted
inserted
replaced
65:8294f3d1efee | 66:55c1b3647357 |
---|---|
1 Require.modules["cache"] = function(exports) { | 1 Require.modules["cache"] = function(exports, require) { |
2 var cache = {}; | 2 var window = require("window"); |
3 var cache; | |
4 | |
5 if (window.localStorage["cache"]) { | |
6 cache = JSON.parse(window.localStorage["cache"]); | |
7 } else | |
8 cache = {}; | |
3 | 9 |
4 exports.set = function set(key, value) { | 10 exports.set = function set(key, value) { |
5 cache[key] = value; | 11 cache[key] = value; |
12 window.localStorage["cache"] = JSON.stringify(cache); | |
6 }; | 13 }; |
7 exports.get = function get(key) { | 14 exports.get = function get(key) { |
8 return cache[key]; | 15 return cache[key]; |
9 }; | 16 }; |
10 }; | 17 }; |