Programatically building dispatcher cache without sending request via browser. | Community
Skip to main content
Level 2
October 16, 2015
Solved

Programatically building dispatcher cache without sending request via browser.

  • October 16, 2015
  • 1 reply
  • 959 views

Hi, Can I programtically build dispatcher cache without hitting out the browser ? I know I can invalidate the cache programatically by sending an http request. How about building the dispatcher cache for my required folder and subfolders without sending requests via browser ? i am using AEM 5.6.1 and Apache 2.2

 

Thanks
Sanjoy

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by PaulMcMahon

Dispatcher by it's nature is not intended to have a prebuilt cache. That said in theory you could do the following:

  1. Configure a Static Replication Agent - see this blog post about the static agent - there isn't a lot of documentation - http://www.wemblog.com/2012/02/how-to-use-static-agent-in-cq-wem.html. You might have to do this on a publish server in order to get the right link rewriting and link checking, and trigger for chain replication after a normal replication to publish. That's a guess though since I have never used the static agent. 
  2. Write a script that watches the target of your static agent and then transfers the new files to you web server. 
  3. Turn off Dispatcher cache flushing

There are probably several holes in that approach that you'll have to fix - for example how to handle a deactivation/deletion - I don't believe the static agent handles that. Also if you are doing any interesting JavaScript on you pages that create JSON or unusual image/file selectors you may have to write custom extensions of the static agent. I have never seen anyone actually do this so I can't speak to how many holes there might be in the process. 

1 reply

PaulMcMahonAccepted solution
Level 8
October 16, 2015

Dispatcher by it's nature is not intended to have a prebuilt cache. That said in theory you could do the following:

  1. Configure a Static Replication Agent - see this blog post about the static agent - there isn't a lot of documentation - http://www.wemblog.com/2012/02/how-to-use-static-agent-in-cq-wem.html. You might have to do this on a publish server in order to get the right link rewriting and link checking, and trigger for chain replication after a normal replication to publish. That's a guess though since I have never used the static agent. 
  2. Write a script that watches the target of your static agent and then transfers the new files to you web server. 
  3. Turn off Dispatcher cache flushing

There are probably several holes in that approach that you'll have to fix - for example how to handle a deactivation/deletion - I don't believe the static agent handles that. Also if you are doing any interesting JavaScript on you pages that create JSON or unusual image/file selectors you may have to write custom extensions of the static agent. I have never seen anyone actually do this so I can't speak to how many holes there might be in the process.