braekling / WP-Matomo

Official WP-Matomo (former WP-Piwik) repository
GNU General Public License v3.0
31 stars 29 forks source link

Registering two API request with different parameters and same method return same data #42

Closed hrhthegreat closed 7 years ago

hrhthegreat commented 7 years ago

Hello, Thanks for your great work on this plugin. I am developing my own plugin and using your plugin to execute API request from Piwik. But, When I register two API request with different parameter and same method, the result is the same. I found the issue, the issue is in the way that you use to cache the data. Request.php line 38 else self::$isCacheable[$id] = $method.'-'.$parameter['period'].'-'.$parameter['date']; So if the method and period and date is the same, the first request result is cached and return as other request results. ( Note that my other parameters are not the same ) I think if you change the string to full serialization of parameters, problem will be solved.

Thanks in advance.

braekling commented 7 years ago

I'll have a look at this... as a workaround, you can disable caching (see WP-Piwik's expert settings).