I am not sure if we have any such functionality out of the box in DXA 2.1, but there is a way to do this. We implemented this and the requirement was the same , whenever we publish a page, cache should be purged , you need to write your own custom logic to implement this.
Welcome to Tridion StackExchange Swapna!
I guess that you’re currently using both DD4T.Providers.DXAModelservice and DD4T.Providers.Tridion9.CIL DLL's in your DD4T web app.
Remove the DD4T.Providers.DxaModelService.dll in your DD4T web app and try again.
Question: Does DD4T.Providers.Tridion9.CIL rely on DXAModelservice?
Answer: No, That’s “traditional”; ...
Refer to the SDL Documentation Content Delivery client configuration of ServiceConfig for Redis CIL cache.
A configuration sample for using Distributed Caching with Redis.
Please update the following fields:
CacheUri - in case of Redis is set to Redis hostname with a port number;
CacheClientId - should be the same for a bunch of ...
What I didn't explain in the answer to Embedded Razor Templates was the reason why. What's happening is that the templates get compiled dynamically, and the resulting type is loaded in the appDomain. If you create a new version of a template building block, the includes are resolved as a simple text include and become part of the resulting type. The mediator ...