Docs Goabase

WeatherCache
in package
uses TraitData, TraitDataWrite

Read onlyYes
FinalYes

Table of Contents

Constants

CACHE_DURATION  = 86400
FORECAST_MAX_DAYS  = 14

Properties

$date  : string
$latitude  : float
$longitude  : float

Methods

__construct()  : mixed
getDataInstance()  : Data
getDataWriteInstance()  : DataWrite
getWeather()  : array<string|int, mixed>|null
Get cached weather data or return null if invalid/expired
setWeather()  : void
Store weather data in cache table
shouldCacheForDate()  : bool
Check if we should attempt to cache weather data for this date
getKey()  : string
Generate key
isValidCache()  : bool
Verify if cached data is still valid

Constants

Properties

Methods

__construct()

public __construct([float $latitude = 0 ][, float $longitude = 0 ][, string $date = '' ]) : mixed
Parameters
$latitude : float = 0
$longitude : float = 0
$date : string = ''

getWeather()

Get cached weather data or return null if invalid/expired

public getWeather() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null

setWeather()

Store weather data in cache table

public setWeather(array<string|int, mixed> $forecast) : void
Parameters
$forecast : array<string|int, mixed>

shouldCacheForDate()

Check if we should attempt to cache weather data for this date

public shouldCacheForDate(string $date) : bool
Parameters
$date : string
Return values
bool

getKey()

Generate key

private getKey() : string
Return values
string

isValidCache()

Verify if cached data is still valid

private isValidCache(array<string|int, mixed> $data) : bool
Parameters
$data : array<string|int, mixed>
Return values
bool

        
On this page

Search results