Index: branches/5.2.x/units/shipping_quote_engines/shipping_quote_engine.php =================================================================== diff -u -N -r14258 -r16777 --- branches/5.2.x/units/shipping_quote_engines/shipping_quote_engine.php (.../shipping_quote_engine.php) (revision 14258) +++ branches/5.2.x/units/shipping_quote_engines/shipping_quote_engine.php (.../shipping_quote_engine.php) (revision 16777) @@ -1,6 +1,6 @@ Application->getUnitOption('sqe', 'TableName') . ' - WHERE LOWER(ClassName) = ' . $this->Conn->qstr( strtolower( get_class($this) ) ); - $data = $this->Conn->GetRow($sql); + $cache_key = 'shipping_quote_engines_data[%SqeSerial%]'; + $cache_value = $this->Application->getCache($cache_key); - if (is_array($data)) { - $properties = $data['Properties'] ? unserialize($data['Properties']) : Array (); - $properties['FlatSurcharge'] = $data['FlatSurcharge']; - $properties['PercentSurcharge'] = $data['PercentSurcharge']; + if ( $cache_value === false ) { + $this->Conn->nextQueryCachable = true; + $sql = 'SELECT Properties, FlatSurcharge, PercentSurcharge, LOWER(ClassName) AS SQEKey + FROM ' . $this->Application->getUnitOption('sqe', 'TableName') . ' + WHERE Status = ' . STATUS_ACTIVE; + $cache_value = $this->Conn->Query($sql, 'SQEKey'); - $this->properties = $properties; + foreach ( $cache_value as $sqe_key => $sqe_data ) { + $properties = $sqe_data['Properties'] ? unserialize($sqe_data['Properties']) : array(); + $properties['FlatSurcharge'] = $sqe_data['FlatSurcharge']; + $properties['PercentSurcharge'] = $sqe_data['PercentSurcharge']; + + $cache_value[$sqe_key]['Properties'] = $properties; + unset($cache_value[$sqe_key]['FlatSurcharge'], $cache_value[$sqe_key]['PercentSurcharge']); + } + + $this->Application->setCache($cache_key, $cache_value); } + + $sqe_key = strtolower(get_class($this)); + + if ( array_key_exists($sqe_key, $cache_value) ) { + $this->properties = $cache_value[$sqe_key]['Properties']; + } else { - $this->properties = Array (); + $this->properties = array(); } } -} \ No newline at end of file + +}