mage2tv / magento-cache-clean

A faster drop in replacement for bin/magento cache:clean with file watcher
BSD 3-Clause "New" or "Revised" License
527 stars 61 forks source link

Reflection cache is not flushed when modifying a api interface #73

Closed cvalcke closed 4 years ago

cvalcke commented 4 years ago

When Magento parse the phpdoc of a api interface to get the type of the parameters (like this example : shorturl.at/lqUZ8) , it store the result in the reflection cache (shorturl.at/vHIPT)

This cache is not automatically flushed when we modify such parameters.

Vinai commented 4 years ago

Unfortunately, I'm unable to see the URLs you provided. The first one brings me to a google maps address in San Diego (MIthril Media), the second one redirects me to the shorturl.at homepage. Can you please update your post with the correct URLs?

Otherwiser, great idea! I hadn't thought of that :)

What do you think, flushing that cache record whenever an API interface is changed should do the trick, right?

cvalcke commented 4 years ago

Sorry for the bad links :)

The first link is a exemple of a params in a api interface : https://github.com/magento/magento2/blob/b42385177d585eed5516a22273873a6b8f9ffaa0/app/code/Magento/CatalogInventory/Api/RevertProductSaleInterface.php#L24

The second one was the code who store the methods params in the cache reflection : https://github.com/magento/magento2/blob/892dee45e4f80ae7df04b4ce550971e5a0453eff/lib/internal/Magento/Framework/Reflection/MethodsMap.php#L151

And finally, yes, if the cache reflection is flushed each time a API interface is changed it will fix the problem.

Vinai commented 4 years ago

Implemented in release 1.0.25.

Could you do me a favor and test if it works for you? I'll leave the issue open for a few days until I hear back from you.

cvalcke commented 4 years ago

I just did a test and I could see the flush of all the methods keys when I modified a parameter.. perfect !!

Thanks for your great Job

(07:50:46 Cleaning id(s): serviceInterfaceMethodsMap-03142a8f80a18ef53d9408a4afac9157 service_method_params_2a56a364013da1629b73d462feaf482f service_method_params_fed2a9b62415042450e24d0ad828799f service_method_params_c108c60c7867ef6957e0bce74d3fdaab service_method_params_999787c9186c49e576270f1d4b26d379 service_method_params_7bf728ab949c9c2e7600bde685baecf0 service_method_params_5da21612dedc23f19da4f38bc104cb41 service_method_params_6a9485d387c2cd8e5a9607b9b8e67b8a service_method_params_708385ec0586b255027724f75fbe62fe )