angular-http-cache icon indicating copy to clipboard operation
angular-http-cache copied to clipboard

Should it be working for HttpClient?

Open rochapablo opened this issue 7 years ago • 1 comments

I'm always getting the requests, shouldn't been getting from cache instead my external api?

import { HttpClient } from '@angular/common/http'
protected _get(action: string = '', params: string = ''): Observable<Object> {
    this.host = `${this.env.host}`;
    return this.http.get(`${this.host}${action}${params}`);
}
angular: 5.2.0
ng-http-cache: 1.2.0

rochapablo avatar Jan 30 '18 14:01 rochapablo

Hello there @rochapablo, are all three of your URL parameters identical between requests (this.host, action, and params)? The URL you pass in is the cache's key, so any tiny change to that URL will cause it to re-execute the request.

danielway avatar May 05 '19 22:05 danielway