diff --git a/site/config/cache.php b/site/config/cache.php index 22d2947a4..d4e8e4e8e 100644 --- a/site/config/cache.php +++ b/site/config/cache.php @@ -5,10 +5,6 @@ 'active' => true, 'type' => 'file' ], - 'meet' => [ - 'active' => true, - 'type' => 'file' - ], 'pages' => [ 'active' => true, 'type' => 'file', @@ -17,7 +13,6 @@ 'features-for-clients', 'home', 'love', - 'meet', 'partners', 'scenario-education', 'themes', diff --git a/site/config/config.getkirby.test.php b/site/config/config.getkirby.test.php index cd9b4b0ea..4f8959232 100644 --- a/site/config/config.getkirby.test.php +++ b/site/config/config.getkirby.test.php @@ -1,12 +1,6 @@ [ - 'meet' => [ - 'active' => true, - 'type' => 'file' - ], - ], 'debug' => true, 'email' => [ 'transport' => [ diff --git a/site/config/routes.php b/site/config/routes.php index 426e9b285..313675ada 100755 --- a/site/config/routes.php +++ b/site/config/routes.php @@ -21,7 +21,6 @@ if (empty($key) === false && get('key') === $key) { kirby()->cache('diffs')->flush(); - kirby()->cache('meet')->flush(); kirby()->cache('pages')->flush(); kirby()->cache('reference')->flush(); } diff --git a/site/controllers/meet.php b/site/controllers/meet.php index 9536f618f..ab1e17443 100644 --- a/site/controllers/meet.php +++ b/site/controllers/meet.php @@ -1,9 +1,21 @@ filterBy('isUpcoming', true); + + // expire the cache 2h after the next upcoming event starts + if ($next = $upcoming->first()) { + $time = $next->datetime()->getTimestamp() + (60 * 60 * 2); + $kirby->response()->expires($time); + $kirby->response()->header('Expires', gmdate('D, d M Y H:i:s T', $time)); + } + return [ - 'events' => $events = collection('events'), - 'upcoming' => $events->filterBy('isUpcoming', true), + 'events' => $events, + 'upcoming' => $upcoming, 'past' => $events->filterBy('isUpcoming', false), 'gallery' => $events->images()->shuffle(), ]; diff --git a/site/models/event.php b/site/models/event.php index 5995ac5dc..cc0ebce80 100644 --- a/site/models/event.php +++ b/site/models/event.php @@ -35,7 +35,7 @@ public function isMeetup(): bool public function isUpcoming(): bool { - return $this->date()->toTimestamp() >= time(); + return $this->datetime()->getTimestamp() >= time(); } public function shortTitle(): Field