Skip to content

Commit 553d4fd

Browse files
authored
chore: refactor DoctrineSummitEventRepository::getAllByPage (#396)
optimice performance
1 parent fa13b25 commit 553d4fd

2 files changed

Lines changed: 453 additions & 334 deletions

File tree

app/ModelSerializers/Summit/Presentation/PresentationSerializer.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public function serialize($expand = null, array $fields = [], array $relations =
116116

117117
$use_cache = $params['use_cache'] ?? false;
118118

119-
if(Cache::has($key) && $use_cache){
119+
if($use_cache && Cache::has($key)){
120120
$values = json_decode(Cache::get($key), true);
121121
Log::debug(sprintf("PresentationSerializer::serialize cache hit for presentation %s", $presentation->getId()));
122122
if (!empty($expand)) {
@@ -398,7 +398,8 @@ public function serialize($expand = null, array $fields = [], array $relations =
398398
}
399399
}
400400

401-
Cache::put($key, json_encode($values), self::CacheTTL);
401+
if($use_cache)
402+
Cache::put($key, json_encode($values), self::CacheTTL);
402403

403404
return $values;
404405
}

0 commit comments

Comments
 (0)