CoolCMS API

GeocodingCacheEntry
in package

FinalYes

One row of `cms_system_geocoding_cache`.

ok is valid permanently (an address does not move); not_found only for NOT_FOUND_RETRY_DAYS days, after which Google may be asked again (the address may have been added meanwhile).

error is only the sentinel row of the circuit breaker (GeocodingCacheKey::externalErrorBreaker()) and is valid for ERROR_RETRY_MINUTES minutes; no address is stored under it.

Table of Contents

Constants

ERROR_RETRY_MINUTES  : int = 2
How long after an external geocoder failure (quota, network) Google is not called again.
NOT_FOUND_RETRY_DAYS  : int = 30

Properties

$coordinates  : GeoCoordinates|null
$countryCode  : string
$createdAt  : DateTimeImmutable
$formattedAddress  : string
$hits  : int
$id  : int
$lastUsedAt  : DateTimeImmutable|null
$query  : string
$queryHash  : string
$status  : string

Methods

__construct()  : mixed
fromRow()  : self|null
isReusable()  : bool
Returns whether the cached answer may be used instead of calling Google.
toLookup()  : GeocodingLookup
toDate()  : DateTimeImmutable|null

Constants

ERROR_RETRY_MINUTES

How long after an external geocoder failure (quota, network) Google is not called again.

public int ERROR_RETRY_MINUTES = 2

Properties

Methods

__construct()

public __construct(int $id, string $countryCode, string $queryHash, string $query, string $status, GeoCoordinates|null $coordinates, string $formattedAddress, int $hits, DateTimeImmutable $createdAt[, DateTimeImmutable|null $lastUsedAt = null ]) : mixed
Parameters
$id : int
$countryCode : string
$queryHash : string
$query : string
$status : string
$coordinates : GeoCoordinates|null
$formattedAddress : string
$hits : int
$createdAt : DateTimeImmutable
$lastUsedAt : DateTimeImmutable|null = null

fromRow()

public static fromRow(array<string, mixed> $row) : self|null
Parameters
$row : array<string, mixed>

table row (snake_case columns)

Return values
self|null

isReusable()

Returns whether the cached answer may be used instead of calling Google.

public isReusable(DateTimeImmutable $now) : bool
Parameters
$now : DateTimeImmutable
Return values
bool

toDate()

private static toDate(mixed $value) : DateTimeImmutable|null
Parameters
$value : mixed
Return values
DateTimeImmutable|null
On this page

Search results