Closed kirstenfrager closed 4 years ago
@kirstenfrager Sorry for the late answer.
I noticed this method getAndSetData
. Does it by any chance first get the data and then set it (calling the POST endpoint)? If so, that might be the issue. The cache will be busted by the getNearbyAdvertsCacheBuster$
subject only when radiusChangeData()
completes (i.e its promise has resolved). Maybe you get the data before that?
@kirstenfrager how you've implemented the cache duration enumeration object CachingMinuteEnum.TWO_MIN
?
I have implemented a PCacheBuster which is only busting the cache the second time I trigger my function.
service.ts
base.ts
The radiusChangeData() function gets triggered when the user changes their location radius (which in turn I want to bust the cache so that new data can be returned within the newly selected radius). The first time the user changes the radius the function gets called but nothing happens, the second time they select it I can see the new data being returned.
What I imagine is happening is that on page load my data get gets cached. On the first radiusChangeData() call I am busting the cache, but then this function has to be called again so that the new data comes back? Is this what seems to be happening?
If so, how can I bust the cache and call the function at the same time with the new data?