Closed marcio199226 closed 5 years ago
Yes, either that, or provide a custom ICacheRequestResolver
to the decorator which might have access to the extra parameter you need. But I still think that your idea in the end is better :)
Yeah I think too that that the last one is the best option.
I have another question can I use multiple @CacheBuster on the same method?Or i have to use one only i then bust some other caches in actions where that method was used ?
You can decorate the method with as many decorators as you want, but I would rather suggest that you combine two cache buster subjects into one stream and provide that to your @Cacheable-decorated methods.
Ok I should merge it by merge operator or concat ? The cache shoulds bust as soon as one of them emits new value
Hi @angelnikolov can you show an example how to merge to subject for CacheBuster ?
@marcio199226 cacheBusterObserver: merge(cacheBusterSubject1, cacheBusterSubject2)
Thx I will try it, vs code highlight it as error so i thought that merging is not enough
It must be cacheBusterObserver: merge(cacheBusterSubject1.asObservable(), cacheBusterSubject2.asObservable())
, sorry :)
Hi I will explain my question with simple example:
So my question is how can I cache some endpoints with inner params that are not provided by method call? I have tried to cache internal closure with all params but without success
Or I have to move all params to method definition in in my case:
Best regards and thanks for this awesome library !
P.S I think that decorators can only decorates methods/properties of class, so maybe we could add an additional param to Cacheable decorator something like this:
And merge this option before this line https://github.com/angelnikolov/ngx-cacheable/blob/master/cacheable.decorator.ts#L43? Do you think it could work?
RE P.S
Seems that something like this is working properly: