1

I have a angular service call to webapi , if webapi is got down , have to load the data from cache and the cache is expire after 20 minutes.

Which is better way to store the data?

LocalStorage - store upto 5 MB and lifetime clear the data of browser, How it will be different from application cache?. SessioStorage - lifetime upto browser closes and in current tab?How it will be different from cache?

In angular 1 ,cachefactory and templatecache for caching technique? In angular2 ,how to cache by using core angular without any third party.

How to see the cache data in other browser and in IE browsers?

if service api not available , cache the data for 20 minutes and expire after 20 minutes? which mechanism is best to handle this situation (webstorage or cache or In memory data service or cookies)

Data Size is 2 MB Object. Here is product service?

_ProductUrl ="http://www.testapi.com/api/product";
    getProduct(): Observable <IProduct[]>{   
      return this._http.get(this._ProductUrl)
        .map((response:Response) =>  <IProduct[]> response.json())
        .catch(this.handleError);

}  

product.component.ts

ngOnInit(){
this._productService.getProduct())
  .subscribe((response) => {
this.productData = response;
}),(err)=> {this.errorMsg =<any>err};

Scenario:

if have store the data in localstorage, it will not available for other users, in this situation how to handle?

eg)if A sends request and getting the success resposne ,store the data in webstorage and able to see the data.if service not available.

Now if b sends request for first time within 20 minutes from other browser,service not available,localstorage is not possible, need to handle this problem?

Mohamed Sahir
  • 2,482
  • 8
  • 40
  • 71

0 Answers0