2016年2月23日 星期二

HTTP cache


table: StoreCache
(url text, content_in_json text)

this.getCache(url) { return content_in_json)
this.setCache(url, content_in_json)

@Server.js
if(server is accessible){
       issue http request as normal;
       StoreCache.setCache(url, json );
       return json;
}else{
      var cache = StoreCache.getCache(url);
       if( cache==null)  alert(need online);          
       else return cache
 }

 

沒有留言:

張貼留言