Skip to content

Commit 1d6e002

Browse files
authored
Cache store in API2 for performance. (#4631)
1 parent a67282c commit 1d6e002

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

app/code/core/Mage/Api2/Model/Resource.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ abstract class Mage_Api2_Model_Resource
172172
*/
173173
protected $_multicall;
174174

175+
/**
176+
* @var Mage_Core_Model_Store
177+
*/
178+
protected $_store;
179+
175180
/**
176181
* Dispatch
177182
* To implement the functionality, you must create a method in the parent one.
@@ -1029,6 +1034,9 @@ public function getEavAttributes($onlyVisible = false, $excludeSystem = false)
10291034
*/
10301035
protected function _getStore()
10311036
{
1037+
if ($this->_store) {
1038+
return $this->_store;
1039+
}
10321040
$store = $this->getRequest()->getParam('store');
10331041
try {
10341042
if ($this->getUserType() != Mage_Api2_Model_Auth_User_Admin::USER_TYPE) {
@@ -1049,6 +1057,7 @@ protected function _getStore()
10491057
// store does not exist
10501058
$this->_critical('Requested store is invalid', Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
10511059
}
1060+
$this->_store = $store;
10521061
return $store;
10531062
}
10541063
}

0 commit comments

Comments
 (0)