-
-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimized EAV Cache #532
Optimized EAV Cache #532
Conversation
becc5a1
to
d5b5f41
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
if (is_null($this->_productAttributes)) { | ||
$this->_productAttributes = array_keys($this->getAttributesUsedInProductListing()); | ||
if (null === $this->_usedInProductListing) { | ||
$this->_usedInProductListing = Mage::getSingleton('eav/config')->getAttributesUsedInProductListing(); | ||
} | ||
return $this->_productAttributes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you not mean to also update the return statement here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between getProductAttributes() and getAttributesUsedInProductListing()?
One change I'm not crazy about is adding code that is specific to |
Great work!
How are we going to test this?
…On Mon, Sep 24, 2018 at 5:12 PM Colin Mollenhour ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Looks great!
------------------------------
In app/code/core/Mage/Catalog/Model/Config.php
<#532 (comment)>:
> @@ -256,8 +256,8 @@ public function getSourceOptionId($source, $value)
*/
public function getProductAttributes()
{
- if (is_null($this->_productAttributes)) {
- $this->_productAttributes = array_keys($this->getAttributesUsedInProductListing());
+ if (null === $this->_usedInProductListing) {
+ $this->_usedInProductListing = Mage::getSingleton('eav/config')->getAttributesUsedInProductListing();
}
return $this->_productAttributes;
Did you not mean to also update the return statement here?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#532 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAn0a203Znrzt7lXg2Qvu_CYdjMe7o93ks5uePZagaJpZM4Wzy_a>
.
|
Looks good, except moving product attribute related cache to eav/config. maybe makes sense to catalog related config model and use it to cache this specific catalog calls. |
Will work on it in the next time |
@@ -310,7 +310,7 @@ public function getAttributeCodesByFrontendType($type) | |||
*/ | |||
public function getStoreLabels() | |||
{ | |||
if (!$this->getData('store_labels')) { | |||
if (false === is_array($this->getData('store_labels'))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_array() always returns a boolean. No need to do such a specific test here. It should just be !is_array()
$setIds = $this->_getSetIds(); | ||
if (!$setIds) { | ||
if (false === is_array($setIds) || count($setIds) === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!is_array($setIds) || !$setIds) {
I tried to resolve conflicts, but it's complicated for I tried to only edit |
@luigifab I have a working alternative/variant that is partially based on some of the logic from this PR as a module (I got impatient waiting for it to be merged over the years). It does however go a bit further (also caches EAV options by attribute set) and has been in production for multiple stores for quite some time. I could rewrite the module as a new PR against 20.x if this is still interesting to have? |
All things that can reduce response time of OpenMage is interesting. If you can, I will very happy to test/use it. |
@luigifab Alright, I will prepare it asap. |
Closed in favour of #2993. |
This pull requests extends the eav cache to preload the entities and also cache them and reduce the amount of queries send to the Databases. In my Environment we reduced the amount of queries from 70 to 40. Also EAV Tags are added to cache entries to evict them on Attribute Save or Attribute set save etc. Also the Peak Memory usage gets lowered.
Here some Queries which gets executed once and cached.