View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0006365 | OXID eShop (all versions) | 4.08. Cache | public | 2016-04-06 11:05 | 2024-03-13 10:24 |
Reporter | hendrikfreytag | Assigned To | |||
Priority | normal | Severity | major | Reproducibility | always |
Status | acknowledged | Resolution | open | ||
Product Version | 4.9.7 / 5.2.7 | ||||
Summary | 0006365: Varnish cache is not invalidated when using the framework without oxshopcontrol | ||||
Description | To use the shop framework you have to include bootstrap.php. So you can use the models to change shop data. If you change and save an article via a command line script which includes bootstrap.php the shop framework will collect URLs to invalidate in varnish. But this URL pool is only collected and the execution of the invalidation will never be done. The problem is that this invalidation execution is done in \oxShopControl::_process. But this function is not executed when using the shop framework in a script. This does not only affect own command line scripts this also affects the ERP interface of OXID. When using the ERP interface the varnish cache is not invalidated. | ||||
Steps To Reproduce | - install and activate varnish - look on a article detail page to load it in cache - change price of the article via ERP interface or command line script - reload article page -> Cached version with old price will be shown. (Use attached test script, it will change TRAPEZ ION MADTRIXX.) | ||||
Additional Information | This has to solved in bootstrap.php, because this is the only thing you need to initialize the shop framework. The bootstrap.php is executed in the start of the script and not at the end, but you need to execute the invalidation at the end. A possibility to solve this is to use register_shutdown_function (http://php.net/manual/de/function.register-shutdown-function.php) to register a function which executed the following lines at the end of script execution: $oxReverseProxyBackend = oxRegistry::get('oxReverseProxyBackend'); $oxReverseProxyBackend->execute(); Maybe this could be added to oxfunctions.php or another place, but it has to be made sure that this will be initialized in the bootstrap.php. | ||||
Tags | EE, ERP, Performance and Caching Rework, Varnish | ||||
Attached Files | |||||
Theme | Not defined | ||||
Browser | Not defined | ||||
PHP Version | Not defined | ||||
Database Version | Not defined | ||||
|
register_shutdown_function will not work good together with php fpm, because there register function may called a long time after the request. So i have to do cache invalidation manually, but interesting is that in php fpm environments you can do something like: fastcgi_finish_request(); $oxReverseProxyBackend = oxRegistry::get('oxReverseProxyBackend'); $oxReverseProxyBackend->execute(); so clients will not wait while varnish cache is being cleared. |
|
see pull request for ERP https://github.com/OXID-eSales/erp/pull/13 |