Mercurial > bugzilla-dashboard
annotate 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 |
rev | line source |
---|---|
66 | 1 Require.modules["cache"] = function(exports, require) { |
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 = {}; | |
47
0b71df72ebe1
integrated dashboard into main.html.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
9 |
0b71df72ebe1
integrated dashboard into main.html.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
10 exports.set = function set(key, value) { |
0b71df72ebe1
integrated dashboard into main.html.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
11 cache[key] = value; |
66 | 12 window.localStorage["cache"] = JSON.stringify(cache); |
47
0b71df72ebe1
integrated dashboard into main.html.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
13 }; |
0b71df72ebe1
integrated dashboard into main.html.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
14 exports.get = function get(key) { |
0b71df72ebe1
integrated dashboard into main.html.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
15 return cache[key]; |
0b71df72ebe1
integrated dashboard into main.html.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
16 }; |
0b71df72ebe1
integrated dashboard into main.html.
Atul Varma <avarma@mozilla.com>
parents:
diff
changeset
|
17 }; |