A version of Guzzle's CachingStream that will read bytes from one stream, write them into another decorated stream, and read them back from a 3rd, undecorated, buffered stream where the bytes are written to.
A read operation is basically:
Read from A, write to B (which decorates C), read and return from C (which is backed by a BufferedStream).
Note that the DecoratedCachingStream doesn't support write operations.
CloneableInstantiable
- Implements
Psr\Http\Message\StreamInterface Stringable - Traits
Methods |
public __call(string $method, array $args) Allow decorators to implement custom methods
|
public __construct(Psr\Http\Message\StreamInterface $stream, callable $decorator, int $minBytesCache = 16384)
|
public __get(string $name) Magic method used to create a new stream if streams are not added in the constructor of a decorator (e.g., LazyOpenStream).
|
public __toString() : string |
public close() : void Close both the remote stream and buffer stream |
public detach() |
public eof() : bool |
public getContents() : string |
public getMetadata( $key = NULL)
|
public getSize() : ?int |
public isReadable() : bool |
public isSeekable() : bool |
public isWritable() : bool |
public read( $length) : string |
public rewind() : void |
public seek( $offset, $whence = 0ZBateson\StreamDecorators\SEEK_SET) : void |
public tell() : int |
public write( $string) : int |
Methods |
protected createStream() : Psr\Http\Message\StreamInterface Implement in subclasses to dynamically create streams when requested.
|
Properties |
private int $minBytesCache
|
private Psr\Http\Message\StreamInterface $readStream
|
private Psr\Http\Message\StreamInterface $stream
|
private ?Psr\Http\Message\StreamInterface $writeStream
|
Methods |
private cacheBytes(int $size) : void |
private cacheEntireStream() : int |