mirror of
https://github.com/agdsn/ancient-weatherstation.git
synced 2026-06-19 23:07:59 +00:00
frontend: caching added
git-svn-id: file:///home/jan/tmp/wetterstation/trunk@247 dd492736-c11a-0410-ad51-8c26713eaf7f
This commit is contained in:
@@ -32,9 +32,13 @@ class Press{
|
||||
/* Funktion, die die Klasse mit den Weten initialisiert */
|
||||
function _fetchPressData(){
|
||||
|
||||
/* Aktuelle Luftdruck bestimmen */
|
||||
$nowQuery = "SELECT press, to_char(timestamp, 'DD.MM.YYYY HH24:MI') as text_timestamp FROM ".$this->table." WHERE sens_id=".$this->sensId." ORDER BY timestamp DESC LIMIT 1";
|
||||
$nowData = $this->connection->fetchQueryResultLine($nowQuery);
|
||||
$nowData = null;
|
||||
if (($nowData = Cacher::getCache("PressNow_ID_".$this->sensId, 3)) == false){
|
||||
/* Aktuelle Luftdruck bestimmen */
|
||||
$nowQuery = "SELECT press, to_char(timestamp, 'DD.MM.YYYY HH24:MI') as text_timestamp FROM ".$this->table." WHERE sens_id=".$this->sensId." ORDER BY timestamp DESC LIMIT 1";
|
||||
$nowData = $this->connection->fetchQueryResultLine($nowQuery);
|
||||
Cacher::setCache("PressNow_ID_".$this->sensId, $nowData);
|
||||
}
|
||||
|
||||
/* Bestimmte Werte den Klassenvariablen zuordnen */
|
||||
$this->nowPress = $nowData['press'];
|
||||
@@ -48,11 +52,15 @@ class Press{
|
||||
}
|
||||
|
||||
function _fetchMinMaxDate(){
|
||||
if($this->maxHum == "nc" || $this->minHum == "nc"){
|
||||
if($this->maxPress == "nc" || $this->minPress == "nc"){
|
||||
$this->_fetchMinMax();
|
||||
}
|
||||
$Query = "SELECT to_char(max(timestamp), 'DD.MM.YYYY HH24:MI') as text_timestamp FROM ".$this->table." WHERE sens_id=".$this->sensId." AND press=".$this->maxPress." OR press=".$this->minPress." GROUP BY press ORDER BY press ASC LIMIT 2";
|
||||
$Data = $this->connection->fetchQueryResultSet($Query);
|
||||
$Data = null;
|
||||
if (($Data = Cacher::getCache("PressExtremDate_ID_".$this->sensId."_MINMAX_".$this->maxTemp."_".$this->minTemp, 130)) == false){
|
||||
$Query = "SELECT to_char(max(timestamp), 'DD.MM.YYYY HH24:MI') as text_timestamp FROM ".$this->table." WHERE sens_id=".$this->sensId." AND press=".$this->maxPress." OR press=".$this->minPress." GROUP BY press ORDER BY press ASC LIMIT 2";
|
||||
$Data = $this->connection->fetchQueryResultSet($Query);
|
||||
Cacher::setCache("PressExtremDate_ID_".$this->sensId."_MINMAX_".$this->maxTemp."_".$this->minTemp, $Data);
|
||||
}
|
||||
$this->minDate = $Data[0]['text_timestamp'];
|
||||
$this->maxDate = $Data[1]['text_timestamp'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user