Feature #1641 - output caching with dynamic tags #1731
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SSR Cache
Vue Storefront generates the Server Side rendered pages to improve the SEO results. In the latest version of Vue Storefront we've added the Output cache option (disabled by default) to improve the performance.
The output cache is set by the following
config/local.json
variables:Dynamic tags
The dynamic tags config uption:
useOutputCacheTaging
- if set to true, Vue Storefront is generating the special HTTP HeaderX-VS-Cache-Tags
Cache tags are assigned regarding the products and categories which are used on the specific page. Typical
X-VS-Cache-Tags
tag looks like this:The tags can be used to invalidate the Varnish cache if You're using it. Read more on that.
Redis
If both
useOutputCache
anduseOutputCacheTagging
options are set totrue
- Vue Storefront is using Output Cache stored in Redis (configured in theredis
section of the config file). Cache is tagged with Dynamic tags and can be invalidated using special webhook:Example call to clear all pages containing specific product and category:
curl http://localhost:3000/invalidate?tag=P1852,C20
Example call to clear all product, category and home pages:
curl http://localhost:3000/invalidate?tag=product,category,home
WARNING:
We strongly recommend You to NOT USE Output cache in the development mode. By using it You won't be able to refresh the UI changes after modyfing the Vue components etc.
Cache invalidation: Recent version of mage2vuestorefront do support output cache invalidation. Output cache is being tagged with the product and categories id (products and categories used on specific page). Mage2vuestorefront can invalidate cache of product and category pages if You set the following ENV variables:
Contribution and currently important rules acceptance