title: Delete localStorage after 1 hour and re-fetch data
body: <p>I just learned about localStorage and wrote a script to cache the data from an ajax request in local storage.  </p>
  
  <p>Can we set a timestamp on the data in localStorage so that after 2 hours it will be deleted and a new ajax request is sent to grab data?  This way if the data is updated it, the user can get access to the new data.</p>
  
  <p>Here's a fiddle to my current code to cache the data in local storage.</p>
  
  <p><a href="http://jsfiddle.net/Q77RL/" rel="nofollow">http://jsfiddle.net/Q77RL/</a></p>
  
  <p>Here's the code as well:</p>
  
  <pre><code>if ( localStorage &amp;&amp; localStorage.getItem('aGithub') ) {
    console.log('if statement using local storage');
    console.log (JSON.parse( localStorage.getItem('aGithub') ));
  }
  else {
    console.log('else statment using ajax');
    $.ajax({
      url : 'https://api.github.com/users/paulirish', //just a test because Paul Irisih is awesome!
      dataType : 'json',
      success : function (data) {
          if ( localStorage ) {
              localStorage.setItem( 'aGithub', JSON.stringify(data) );    
          }
          console.log(data);
      }
    });
  }
  </code></pre>