I would like to set up a cache by having a service hold a reference to a BehaviorSubject
which will call an API endpoint initially and then emit that result. The tricky thing for me is figuring out how to set a TTL so that if XX seconds has elapsed it recalls the API endpoint instead of returning the last result.
Is this possible with RxJS, or would I need to set up my own timers to 'reset' the BehaviorSubject
?