Module methanol

Class CacheWritingPublisher

java.lang.Object
com.github.mizosoft.methanol.internal.cache.CacheWritingPublisher
All Implemented Interfaces:
Flow.Publisher<List<ByteBuffer>>

public final class CacheWritingPublisher extends Object implements Flow.Publisher<List<ByteBuffer>>
A Publisher that writes the body stream into cache while simultaneously forwarding it to downstream. The publisher prefers writing the whole stream if downstream cancels the subscription midway transmission. Forwarding downstream items is advanced independently of writing them. Consequently, writing may lag behind downstream consumption, and may proceed after downstream has been completed. This affords the downstream not having to unnecessarily wait for the entire body to be cached. If an error occurs while writing, the edit is silently discarded.