CLI commands
P2Lab Cache adds Symfony console commands you can call from bin/console. All commands work the same way the rest of Shopware’s CLI does — they respect --env=prod, return non-zero exit codes on failure, and integrate with deployment tooling.
p2lab:cache:clear
Section titled “p2lab:cache:clear”Clears every cached page from the backend.
bin/console p2lab:cache:clearExit codes
0— success; the number of files removed is printed- non-zero — an exception was raised during clearing; see the message
Typical use
Run as the last step of a production deployment, after cache:clear and any migrations:
bin/console plugin:refreshbin/console plugin:update P2LabCachebin/console cache:clearbin/console p2lab:cache:clearShopware’s standard commands you should know
Section titled “Shopware’s standard commands you should know”P2Lab Cache hooks into Shopware’s standard CLI primitives. The following commands matter:
bin/console cache:clear
Section titled “bin/console cache:clear”Clears the Symfony application cache. This also drops any pages stored in the Filesystem backend (because they live under var/cache/). Run after deployments.
bin/console messenger:consume async
Section titled “bin/console messenger:consume async”Processes the async message queue. P2Lab Cache uses it for cache warming and a few invalidation paths. Run as a long-lived process in production.
bin/console messenger:consume scheduler
Section titled “bin/console messenger:consume scheduler”Processes scheduled tasks — including the three nightly cleanup tasks shipped by P2Lab Cache (see Scheduled tasks).
bin/console scheduled-task:list
Section titled “bin/console scheduled-task:list”Lists every scheduled task in the system. Look for entries beginning with p2lab_cache. to confirm the plugin’s tasks are registered.
Triggering the REST API from CLI
Section titled “Triggering the REST API from CLI”The plugin’s REST API is the recommended way to script cache operations beyond clearing. For example, to start a warmup from a deploy script:
TOKEN=$(curl -s -X POST https://shop.example.com/api/oauth/token \ -H "Content-Type: application/json" \ -d '{"grant_type":"client_credentials","client_id":"...","client_secret":"..."}' \ | jq -r '.access_token')
curl -X POST https://shop.example.com/api/_action/p2lab-cache/warmup/start \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"salesChannelId":null,"batchSize":100}'See REST API for the full endpoint list.