CacheExtractor implements Extractor, Refreshable
Interfaces
Methods
- __construct() : mixed
- boundTo() : self
- This source reading $cache when the constructor was handed none; a copy, so the user's source stays unbound.
- extract() : Generator<Signal|null, void>
- Yields rows in batches. When the source is a BatchableExtractor a batch holds between 0 and that extractor's own batchSize() rows; the size is chosen by the extractor and MAY vary between batches. Consumers must not assume a minimum size, a constant size, or a non-empty batch.
- isRepeatable() : bool
- A missing entry reads the fallback on every read and never fills the cache, so the fallback must repeat too.
- refresh() : void
- Drops the listing and everything derived from it, so the next run lists the source again. A run calls it when it ends; a plan that does not run (explain(), schema()) keeps what it listed for the run that follows.
- schema() : Schema
- Answers before extract() runs, so every batch it yields carries this shape. Takes no FlowContext: a source that needs the pipeline's context to describe itself has not moved the answer to bind time.
- statistics() : Statistics
- Answers from the arm extract() will take, and only when a cache was handed to the constructor: one taken from the FlowContext may hold the entry this cache lacks.
- withClearOnFinish() : self
- withFallbackExtractor() : self
- withSchema() : static
- Declares the shape every yielded batch must carry. A source that describes itself uses this instead of its own description, and values are cast to fit.
Methods
__construct()
public
__construct(string $id[, RowsStorage|null $cache = null ]) : mixed
Parameters
- $id : string
- $cache : RowsStorage|null = null
boundTo()
This source reading $cache when the constructor was handed none; a copy, so the user's source stays unbound.
public
boundTo(RowsStorage $cache) : self
Parameters
- $cache : RowsStorage
Return values
selfextract()
Yields rows in batches. When the source is a BatchableExtractor a batch holds between 0 and that extractor's own batchSize() rows; the size is chosen by the extractor and MAY vary between batches. Consumers must not assume a minimum size, a constant size, or a non-empty batch.
public
extract(Backend $backend, Criteria $criteria) : Generator<Signal|null, void>
Parameters
Return values
Generator<Signal|null, void>isRepeatable()
A missing entry reads the fallback on every read and never fills the cache, so the fallback must repeat too.
public
isRepeatable() : bool
Return values
boolrefresh()
Drops the listing and everything derived from it, so the next run lists the source again. A run calls it when it ends; a plan that does not run (explain(), schema()) keeps what it listed for the run that follows.
public
refresh() : void
schema()
Answers before extract() runs, so every batch it yields carries this shape. Takes no FlowContext: a source that needs the pipeline's context to describe itself has not moved the answer to bind time.
public
schema() : Schema
Called once per RUN - every run plans afresh - so it MUST be idempotent and cheap on repeat: memoise what it sniffs, as CSVExtractor and ArrayExtractor do.
Return values
Schemastatistics()
Answers from the arm extract() will take, and only when a cache was handed to the constructor: one taken from the FlowContext may hold the entry this cache lacks.
public
statistics() : Statistics
Return values
StatisticswithClearOnFinish()
public
withClearOnFinish(bool $clear) : self
Parameters
- $clear : bool
Return values
selfwithFallbackExtractor()
public
withFallbackExtractor(Extractor $fallbackExtractor) : self
Parameters
- $fallbackExtractor : Extractor
Return values
selfwithSchema()
Declares the shape every yielded batch must carry. A source that describes itself uses this instead of its own description, and values are cast to fit.
public
withSchema(Schema $schema) : static
Parameters
- $schema : Schema