We have a scheduled updateData job that updates nodes in our workspace (CRUD 
operations on nodes) and then activates/deactivates the nodes as appropriate.

Do I understand correctly that you are using your own custom workspace? (I 
assume so below)

 I am trying to clear the caches so that the pages affected can show the 
updated content.  I have not had any success with my attempts at clearing the 
cache.
 In code what I do is after the update process has run, invoke the clear and 
activePage methods.

Um, you are running that code on the author instance right? In this case 
calling clear() would clear only cache of the  said author instance, but not 
the public.

Ah, I assumed that clearing cache would also clear the cache on all configured 
subscribers.

 I initially thought only clear would do the trick, but neither of them do.
 On the public instance I see deleted nodes on the list pages until I perform a 
manual "Activate changes" on the appropriate page on the website pane.

Yeah, activating the page from website will indeed cause flushing the cache 
_on_public_ instance.
 Using the Tools->Cache Tools->Flush all caches too does not seem to have any 
effect on the output html from the page.

Just to double check, you did this on public? If so it should have exactly same 
effect as activating the page.

No, I did the flush cache only on author as I mentioned above.

 The manual activation does the trick however.  The affected pages are 
freemarker templates that get all the JCR data through a model class.  The 
queries in the model class are raw XPATH queries against our workspace.  There 
are no paragraphs or any other sub-components that I need to worry about, just 
the node data as returned by the model classes.

So, the question is what exactly I need to do to ensure that the affected pages 
are refreshed?

Well, what you need to do is to flush the cache on the public instance. Most of 
the time that should be seamless and taken care of by Magnolia for you. However 
since you are using custom workspace, Magnolia will not know it needs to flush 
the cache on activation to that workspace too. Go to the 
condig:/modules/cache/config/configurations/default/flushPolicy/policies/flushAll/repositories
 and add name of your workspace to the list. That way you tell Magnolia to 
flush the cache on updates to the workspace.

Now you should have it working. If you want to play smarter and you know 
exactly what pages are rendering data from that repo (or maybe it is a set of 
pages using same page template?) you can write custom policy that would go and 
fish out only those pages from the cache bucket and leave everything else in. 
For that you can use methods for retrieving all the cache keys generated from a 
page using page UUID and then using the keys you can remove only the specific 
entries from the cache instead of flushing all. This is what for example 
FlushByComments policy in EE does.

Thanks for these hints.  Yes, I know the list of pages that are affected by the 
data update.  I will be using that to clear all required cache after the update 
process completes from the author instance.

Thanks
Rakesh

HTH,
Jan


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to