Closed manojktechie closed 5 years ago
Hmm, it should be working. How do you know that it isn't, what are you doing exactly?
It's not working because the results are not getting refreshed after creating records. It's picking the list from cache. In other words, I am calling getCountrys() after createCountry() to get the updated list but the api is not getting called. Instead it is returning the result from cache.
@angelnikolov it was my mistake. My API to create record was returning error and because of this Cachebuster was not working. Thank you for your help :)
Hi,
I tried to implement Cacheable and CacheBuster. Cacheable is working fine but somehow CacheBuster is not working. Below is the code:
` import { Cacheable, CacheBuster } from 'ngx-cacheable'; const countryCacheBuster$ = new Subject();
@CacheBuster({ cacheBusterNotifier: countryCacheBuster$ }) public createCountry(country: Country): Observable {
return this.http
.post(
${this.url}/api/createCountry
, country, { withCredentials: true }); }@Cacheable({ cacheBusterObserver: countryCacheBuster$ }) getCountrys(): Observable {
return this.http.get(
${this.url}/api/getCountryList
) .pipe( catchError(error => error) ); } `Where I am doing wrong ? Please help.