Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F803924
D405.id1012.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Feb 26, 9:01 AM
Size
1 KB
Mime Type
text/x-diff
Expires
Thu, Feb 27, 9:01 AM (7 h, 48 m)
Engine
blob
Format
Raw Data
Handle
576644
Attached To
D405: INP-1802 - Speed up detection of countries with states
D405.id1012.diff
View Options
Index: core/units/helpers/country_states_helper.php
===================================================================
--- core/units/helpers/country_states_helper.php
+++ 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;
}
/**
Event Timeline
Log In to Comment