Skip to content

Commit

Permalink
Merge pull request #164 from City-of-Helsinki/UHF-X-address-search-ca…
Browse files Browse the repository at this point in the history
…ching

UHF-X: Fix caching issue in address search
  • Loading branch information
hyrsky authored Dec 7, 2023
2 parents 5987e30 + 31f7b08 commit 6d5e7f0
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ public static function sortByAddress(ViewExecutable $view): ViewExecutable {
(float) $result->_entity->get('latitude')->getString(),
(float) $result->_entity->get('longitude')->getString());

// The entity should not be cached since it relies on high-cardinality
// user input.
$result->_entity->mergeCacheMaxAge(0);

// Set the distance to computed field.
$result->_entity->set('distance', $distances[$result->_entity->get('id')->getString()]);
}
Expand Down

0 comments on commit 6d5e7f0

Please sign in to comment.