Skip to content

Commit ed1e8ed

Browse files
authored
Add blink caching to collection and forms (#557)
1 parent c316473 commit ed1e8ed

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/Entries/EntryQueryBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ private function getCollectionsForStatusQuery(): \Illuminate\Support\Collection
154154
return collect($this->builder->getQuery()->wheres)
155155
->where('column', 'collection')
156156
->flatMap(fn ($where) => $where['values'] ?? [$where['value']])
157-
->map(fn ($handle) => Collection::find($handle));
157+
->map(fn ($handle) => Blink::once("eloquent-collection-{$handle}", fn () => Collection::find($handle)));
158158
}
159159

160160
private function getKeysForTaxonomyWhereBasic($where)

src/Forms/SubmissionQueryBuilder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Statamic\Contracts\Forms\SubmissionQueryBuilder as BuilderContract;
66
use Statamic\Data\DataCollection;
7+
use Statamic\Facades\Blink;
78
use Statamic\Facades\Form;
89
use Statamic\Query\EloquentQueryBuilder;
910
use Statamic\Support\Str;
@@ -37,7 +38,7 @@ protected function transform($items, $columns = [])
3738
{
3839
return DataCollection::make($items)->map(function ($model) {
3940
return Submission::fromModel($model)
40-
->form(Form::find($model->form));
41+
->form(Blink::once("eloquent-forms-{$model->form}", fn () => Form::find($model->form)));
4142
});
4243
}
4344

0 commit comments

Comments
 (0)