Skip to content

Commit 2086c3d

Browse files
author
Aurélien FOUCRET
committed
Use local caching into getLanguageCodeByStore. Improved indexing performances by a factor of 10.
1 parent f95ca76 commit 2086c3d

File tree

1 file changed

+4
-1
lines changed
  • src/app/code/community/Smile/ElasticSearch/Helper

1 file changed

+4
-1
lines changed

src/app/code/community/Smile/ElasticSearch/Helper/Data.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ public function getLanguageCodeByLocaleCode($localeCode)
8585
*/
8686
public function getLanguageCodeByStore($store = null)
8787
{
88-
return $this->getLanguageCodeByLocaleCode($this->getLocaleCode($store));
88+
if (!isset($this->_languageCodes[$store->getStoreId()])) {
89+
$this->_languageCodes[$store->getStoreId()] = $this->getLanguageCodeByLocaleCode($this->getLocaleCode($store));
90+
}
91+
return $this->_languageCodes[$store->getStoreId()];
8992
}
9093

9194
/**

0 commit comments

Comments
 (0)