For local storage, use chrome.storage.local . It has a very simple API and 5 MB of memory for each profile.
The permission is "storage" and it will give you access to chrome.storage.local and chrome.storage.sync . local - 5 MB per profile stored on the client. sync - sync saved in your Google account. The same API.
I found sync unreliable, but your needs look like local .
Using:
function fetchLive(callback) { doSomething(function(data) { chrome.storage.local.set({cache: data, cacheTime: Date.now()}, function() { callback(data); }); }); } function fetch(callback) { chrome.storage.local.get(['cache', 'cacheTime'], function(items) { if (items.cache && items.cacheTime && items.cacheTime) { if (items.cacheTime > Date.now() - 3600*1000) { return callback(items.cache);
source share