XMLTool cache setting

9 views
Skip to first unread message

Jim Crone

unread,
Oct 20, 2019, 10:56:04 PM10/20/19
to dotCMS User Group
I am using the XMLTool to pull an external XML file and then display some of the contents on a page.  It works, however, it seems that dotCMS will only pull an updated version of the XML file every 30 minutes or so (even if the source file has been updated in the meantime).  Is there a way I can alter the amount of time this particular XML file is cached by changing a setting before/after the XMLTool is used on the page?

Thanks,
Jim

Mark Pitely

unread,
Oct 21, 2019, 9:59:58 AM10/21/19
to dot...@googlegroups.com
Jim,

I don't think this is an issue with the XMLTool; perhaps check the
'page settings' on the page - most new dotCMS pages put a 15 minute
cache on by default.
In general, you can always use &dotcache=refresh to override the
internal caching. Also, check out the #dotcache velocimacro to make
your own caching on the specific item. You definitely want some sort
of cache on a call like that. Lastly, depending on what is serving the
XML, the fault might be there.
I can assure you that the $import.read (which you could use in place
of the XML tool) function does not have an internal cache timeout.
There is a cache issue, however, if you use any of these tools more
than once on a page, it will often return the same content despite
being a different url. That's a painful lesson I don't want you to
have to learn for yourself.
I have had a lot of success by doing these calls on a page with a
blank template to yank in the content, and using javascripts' tools
(fetch,xmlhttprequest) on a 'real' page to display it. It's an extra
step but it can make things easier to maintain (and adds some
asynchronous support if the external server is slow/down/etc.)

Mark Pitely
Marywood University
> --
> http://dotcms.com - Open Source Java Content Management
> ---
> You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/9efb83db-b1b7-4c17-9157-1695598c04ff%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages