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

The custom template format consists of two parts,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
      partNumber Get the normalized partNumberof the specific updated item.
      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
      categoryId Get the catgroup id of a specific category.

How to build a custom template?

Here is an example of the custom template. The first part of it is the Name and can be customized with any text. The second part is the Variables which has to follow a certain name.
Note: You can send many base template components in one invalidation.
storeId:partNumber:{supportedStoreId}:{partNumber}
The aforementioned custom template generates the following invalidation:
storeId:partNumber:1:test_10001
In the case of multiple storeIDs the invalidation is triggered in the following manner:
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.

Here is an example of the multi invalidation custom template:
storeId:partNumber:{supportedStoreId}:{partNumber};categoryId:{parentCategoryId}
The aforementioned multi invalidation custom template generates the following invalidation:
storeId:partNumber:1:test_10001
categoryId:10001

How to customize fine -grained cache invalidation?

Once you create custom templates for product and category invalidation, use the following JSON to customize the fine-grained cache invalidation. For detailed instructions on customizing processors, connectors, refer to Extending Ingest connectors.
{
    "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"
                    }
                }
            ]
        }
    ]
}