magespecialist / m2-MSP_APIEnhancer

Magento2 API Cache and enhancements
82 stars 29 forks source link

Multistore Issue. One response for all stores. #3

Open AleksLi opened 6 years ago

AleksLi commented 6 years ago

Preconditions

  1. Magento 2.2.3
  2. mysql Ver 15.1 Distrib 10.0.31-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
  3. PHP 7.0.22

    Steps to Reproduce

  4. Install this module (obviously)
  5. Multistore.

    Expected Result

  6. Cached response for each store separetely

    Actual Result

  7. I've got one result for each store.

One comment about this situation.

I've fixed that issue by adding new key into

<type name="MSP\APIEnhancer\Api\CacheManagementInterface">
        <arguments>
            <!--
            This set of keys is for non-Varnish keys configuration
            It should be based on request information only
            -->
            <argument name="keys" xsi:type="array">
                <item name="store" xsi:type="object">MyCompany\WebApi\Model\CacheKeyProcessor\Store</item>
            </argument>
        </arguments>
    </type>

MyCompany\WebApi\Model\CacheKeyProcessor\Store returns new key with store Id.

bvboas commented 5 years ago

Isn't the store code part of the URI

[rest/default/V1/products/:sku]

and with that a different key is generated?

I can't reproduce this issue...