I need help on how to flush selector based caching
http://example.com/content/myapp/us/en.child1.xml
http://example.com/content/myapp/us/en.child2.xml
Lets say,we have xml's cached under the folder as
/<docroot-cache>/content/myapp/us/
->en.child1.xml
->en.child2.xml
->en.child99.xml
->en.child100.xml
->en.html
->en.model.json
I need to provide selector based caching, that is to flush en.child1.xml only and should not flush en.child2.xml or other xml's when the request for flush happens for /content/myapp/us/en.child1.xml
I've tried dispatcher flush invalidation through HTTP call like below-
GET http://mydispatcher/dispatcher/invalidate.cache
Headers
CQ-Action Activate
CQ-Handle /content/myapp/us/en.child1.xml
Content-Type Application/xml
But,all files under "us" folder(i.e. all selector for en page) gets invalidated, how to just invalidate "en.child1.xml" please suggest
Solved! Go to Solution.
Views
Replies
Total Likes
@vamshim15803391 got this working. Instead of Activate , you need to use DELETE as action. PFB the screenshots
Before
Flush
After
Action should be CQ-Action: Delete instead of Activate
Hope this works
Thanks
Veena
I tried flushing the cache for the below scenario and was able to do it . Please check the screenshots
Before Flushing
Flush
After Flush
Ideally , the files should get flushed if the invalidate headers are proper. Could you please cross check ?
Thanks
Veena
Views
Replies
Total Likes
Hi Veena, thanks for checking this.
Looks like you have only placed 1 file and yes it invalidates en.child.xml (along any file selectors ,extensions of en)
Can you manually create 2files say en.child1.xml and en.child2.xml and have the request of CQ-Handle /content/we-retail/us/en.child1.xml and flush. It should flush child1.xml only, & child2.xml still should remain in cache And yes, I have the same headers as yours.
Views
Replies
Total Likes
Views
Replies
Total Likes
Hi,
Not sure if you can do that using below command because if
POST /dispatcher/invalidate.cache HTTP/1.1 CQ-Action: Activate CQ-Handle: path-pattern Content-Length: 0
Dispatcher creates .stat files in each folder from the docroot folder down to the level that you specify. The docroot folder is level 0. When an invalidation request comes in, it will clear that resource and its parent folder to which statfileslevel is set to.
What is your /statfileslevel property in dispatcher config set to ?
Views
Replies
Total Likes
You should be able to use the ResourceOnly cache invalidation for this scenario - Refer the following video for more details https://youtu.be/teSn_Tqnizo
Thanks for the input Albin, I will check if this works
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Replies
Total Likes
@vamshim15803391 got this working. Instead of Activate , you need to use DELETE as action. PFB the screenshots
Before
Flush
After
Action should be CQ-Action: Delete instead of Activate
Hope this works
Thanks
Veena
Views
Replies
Total Likes
Views
Replies
Total Likes
If ResourceOnly flushes don't solve this then you can look into implementing a custom invalidation handler script:
https://arborydigital.com/blog/2019/12/05/aem-dispatcher-custom-invalidation-scripts/
Views
Replies
Total Likes
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies