Index: branches/5.2.x/core/units/helpers/country_states_helper.php =================================================================== --- branches/5.2.x/core/units/helpers/country_states_helper.php +++ branches/5.2.x/core/units/helpers/country_states_helper.php @@ -50,19 +50,21 @@ */ function getCountriesWithStates() { - static $cache = null; + $cache_key = 'countries_with_states[%CountryStateSerial%]'; + $cache_value = $this->Application->getCache($cache_key); - if (!isset($cache)) { + if ( $cache_value === false ) { $table_name = $this->Application->getUnitOption('country-state', 'TableName'); $sql = 'SELECT DISTINCT cname.IsoCode, cid.StateCountryId FROM ' . $table_name . ' cid JOIN ' . $table_name . ' cname ON cname.CountryStateId = cid.StateCountryId WHERE cid.StateCountryId IS NOT NULL'; - $cache = $this->Conn->GetCol($sql, 'StateCountryId'); + $cache_value = $this->Conn->GetCol($sql, 'StateCountryId'); + $this->Application->setCache($cache_key, $cache_value); } - return $cache; + return $cache_value; } /**