Fine-grained cache invalidation
Live fine-grained cache invalidations are sent from the Push-to-live connector. Fine-grained cache invalidation allows scoping cache invalidation to individual products or categories to rebuild only the necessary cache. It helps to minimize the runtime impact at the time of cache invalidation. You can create a custom template for product and category invalidation. This means you can set the desired product and category cache invalidation and the place to send this custom invalidation.
Custom template structure
Names:{Variables}
where: - Names: usually be dictated by the cache spec
- Variables: the following product and category variables from the
processor:
- Product variables
Variable name Description supportedStoreId Get the list of store Id of a specific catentry from Elasticsearch product index. partNumber Get the normalized partNumberof the specific updated item. parentCategoryId Get the list of parent category that the specific product belongs to. skuCatentryId Get the list of catentries showing products sku. productPartNumber Get the normalized partNumber of the specific updated item based on its type: - product = product partNumber
- sku = find its parent product and return that partNumber
catentryId Get the catentry of the specific updated item. productId Get the catentry of the specific updated item based on its type: - product = acts the same as catentryId
- sku = find its parent product and return that catentryId
- Category variables
Variable name Description supportedStoreId Get the list of store Id of a specific catgroup from Elasticsearch category index. categoryId Get the catgroup id of a specific category. childCategoryId Get the list of child categories of the specified category.
- Product variables
How to build a custom template?
Name
and can be customized with any text. The second part is
the Variables
which has to follow a certain name.storeId:partNumber:{supportedStoreId}:{partNumber}
The
aforementioned custom template generates the following
invalidation:storeId:partNumber:1:test_10001
storeId:partNumber:1:test_10001
storeId:partNumber:10501:test_10001
How to build a custom template for multi invalidations?
You can issue multiple custom templates in one entry by specifying the multiple custom templates. The multiple custom templates are added by using comma to separate each custom template in an entry.
storeId:partNumber:{supportedStoreId}:{partNumber};categoryId:{parentCategoryId}
storeId:partNumber:1:test_10001
categoryId:10001
How to customize fine -grained cache invalidation?
{
"name": "push-to-live",
"pipes": [
{
"name": "WorkspacePublishing",
"properties": [
{
"name": "properties.Product Invalidation Template",
"value": "storeId:partNumber:{supportedStoreId}:{partNumber}",
"scope": {
"name": "Workspace Publishing Invalidations.WorkspacePublishInvalidation",
"type": "PROCESSOR"
}
},
{
"name": "properties.Category Invalidation Template",
"value": "storeId:category:{supportedStoreId}:{categoryId}",
"scope": {
"name": "Workspace Publishing Invalidations.WorkspacePublishInvalidation",
"type": "PROCESSOR"
}
},
{
"name": "properties.Cache Name",
"value": "someCache",
"scope": {
"name": "Workspace Publishing Invalidations.WorkspacePublishInvalidation",
"type": "PROCESSOR"
}
}
]
}
]
}