Is there a better way to store an observable resul...
# rx
l
Is there a better way to store an observable result for replay than replay subject? I have a stream that I want to create and execute the first time it's called, and then afterwards subscribing to that observable would just return the items that were originally emitted during the first call, rather than redo all of the processing. Describing this sure sounds like describing the lazy pattern (do work once, return repeatedly) but Googling the idea just gives you lazy stream generation, not results.
g
Maybe
.cache()
and its overloads do what you want?
a
yeah
cache
or
share
is probably what you're looking for.
u
well... replay(1) ? thats exactly whats it for, but you need to subscribe to the same instance
j
share+replay