/
kCountryStatesHelper doesn't cache countries without states

kCountryStatesHelper doesn't cache countries without states

When user information is loaded from database ("UsersEventHandler::OnAfterItemLoad" method), then the states, that match user selected country are populated to user object as well ("kCountryStatesHelper::PopulateStates" method). It turns out, that later method isn't very effective at what he does:

  • it resolves country ISO code to it's ID in database via "getCountryStateId" method (does SQL each time it's called)
  • it doesn't cache states for countries that have states (does SQL each time when user has country without states)

This adds 2 more SQL queries per each user load.

I propose that we solve that by caching these SQL results into Memcache.

country_states_helper_memcache_addon.patch

shared_state_cache_between_countries_fix.patch

Related Tasks

INP-1362 - Getting issue details... STATUS