Skip to content
This repository has been archived by the owner on Jul 18, 2022. It is now read-only.

Commit

Permalink
Don’t process entries with no route
Browse files Browse the repository at this point in the history
  • Loading branch information
aerni committed Jun 24, 2021
1 parent 2bc49b3 commit 585d99f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace Aerni\DynamicCache;

use Aerni\DynamicCache\Contracts\Data as DataContract;
use Illuminate\Support\Collection;
use RecursiveArrayIterator;
use Statamic\Facades\Entry;
use RecursiveIteratorIterator;
use Statamic\Entries\Entry;
use Illuminate\Support\Collection;
use Aerni\DynamicCache\Contracts\Data as DataContract;

class Data implements DataContract
{
Expand Down Expand Up @@ -43,6 +43,10 @@ public function getInvalidationRules(): Collection
private function entriesToExcludeFromStaticCache(): Collection
{
return Entry::all()->map(function ($entry) {
if (empty($entry->route())) {
return false;
}

if ($this->shouldExcludeEntryFromStaticCache($entry->values())) {
return $entry;
}
Expand All @@ -53,6 +57,10 @@ private function entriesToExcludeFromStaticCache(): Collection
private function entriesToIncludeInInvalidationRules(): Collection
{
return Entry::all()->map(function ($entry) {
if (empty($entry->route())) {
return false;
}

if (! $this->shouldExcludeEntryFromStaticCache($entry->values())) {
return $entry;
}
Expand Down

0 comments on commit 585d99f

Please sign in to comment.