Add tests and functionality for model::cursor()
method.
#513
Replies: 2 comments
-
@mikebronner I have had a look at this and it seems that it completely skips caching as it uses Eloquent\Builder public function cursor()
{
// Swaps to using QueryBuilder ⬇️ then ⬇️ creates `LazyCollection`
return $this->applyScopes()->query->cursor()->map(function ($record) {
return $this->newModelInstance()->newFromBuilder($record);
});
} Query\Builder public function cursor()
{
if (is_null($this->columns)) {
$this->columns = ['*'];
}
return new LazyCollection(function () {
yield from $this->connection->cursor(
$this->toSql(), $this->getBindings(), ! $this->useWritePdo
);
});
} So you could say use of In my opinion it is probably not necessary to cache the |
Beta Was this translation helpful? Give feedback.
-
@dmason30 Good analysis! I add this to the documentation that this method is not cached. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
All reactions