servicetalk
servicetalk copied to clipboard
Introduce a cache for Publishers that tracks subscriptions to manage the cache
Motivation:
Handling the caching of Publishers comes up often and correctly managing the cache can be tricky and error prone to implement correctly. Scenarios where caching of Publishers can be useful include those similar to the multicast and replay operators but have the added dimension of asynchronous access, for instance multiple requests which need to consume the same data.
Modifications:
Add a PublisherCache utility that manages the lifecycle of a cached Publisher. A publisher is removed from the cache when it no longer has any subscriptions.
Will mark it as draft for now, mark as ready when comments are addressed or close if no plans to continue on this one.