I have a question about the way OPS handles caching; I'm trying to
figure out whether my pipeline will do what I want it to do. Here's some background. I'm internationalizing an existing OPS app, and trying to take advantage of caching for the "static" elements in the page (labels, page headers, etc.). Here's a simplified version of the pipeline in question: <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline" etc...> <p:param type="input" name="request"/> <p:param type="output" name="view"/> <!-- The "request" input is a processed version of the output from the OPS request generator. The important thing here is that it contains a subtree at "/req/site" that tells me what version of the site to serve, and a subtree at "/req/locale" that contains the desired locale for this request, like "en_US". There is only a small set of possible sites, and a small set of locales. --> <!-- Fill in the menu, subnav, etc --> <!-- This transform populates tags in the template like <twc:menu/> with a list of the menu items that should appear. This can vary depending on the site and the locale. --> <p:processor name="oxf:unsafe-xslt"> <p:input name="config" href="oxf:/framework/view/insert-nav.xsl"/> <p:input name="data" href="oxf:/a-file-from-disk-somewhere"/> <p:input name="site" href="#request#xpointer(/req/site)"/> <p:input name="locale" href="#request#xpointer(/req/locale)"/> <p:output name="data" id="raw-view-with-nav"/> </p:processor> <!-- Localize the completed template --> <!-- This transform replaces <twc:i18n>some-text</twc:i18n> tags with the appropriate text for the locale. --> <p:processor name="oxf:unsafe-xslt"> <p:input name="config" href="oxf:/framework/view/localize.xsl"/> <p:input name="data" href="#raw-view-with-nav"/> <p:input name="site" href="#request#xpointer(/req/site)"/> <p:input name="locale" href="#request#xpointer(/req/locale)"/> <p:output name="data" ref="view"/> </p:processor> </p:config> My question has to do with the "site" and "locale" inputs to those two transforms. I'm using XPointer to peel off just the "site" and "locale" elements, and I want the results of this pipeline to be cached using those elements to determine the validity: in other words, for any given combination of template file, site, and locale, I only want to run this pipeline once. Will this pipeline have the desired result? Or will the cache validity be determined by the whole "request" input, which will of course be different with every request? Is there something else I can do that will give me the desired caching behavior? Thanks in advance for any help you can offer. Jeff Jones Sr. Internet Appl. Developer The Weather Channel Interactive Sr Internet Appl Dev -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
Jeff,
> My question has to do with the "site" and "locale" inputs to those > two transforms. I'm using XPointer to peel off just the "site" and > "locale" elements, and I want the results of this pipeline to be > cached using those elements to determine the validity: in other > words, for any given combination of template file, site, and locale, > I only want to run this pipeline once. > > Will this pipeline have the desired result? Or will the cache > validity be determined by the whole "request" input, which will of > course be different with every request? Is there something else I > can do that will give me the desired caching behavior? An XPointer expression within p:input/@href is transformed into an internal XPathProcessor. The output of the processor (which is connected to the "site" and "locale" inputs of the XSLT processor) depends, from a caching perspective, on the value of the XPath expression *and* on the document on which the XPath epxression applies, that is #request. On the XSLT side, caching of the output will occur only if you refer to the "site" and "locale" inputs statically, e.g. by using doc('input:site') and doc('input:locale'). If you compute the parameters to the doc() or document() function, caching will not occur. So I think the answer to your question is that the output of the XSLT transformation will be cacheable based on all the XSLT transformation's dependencies, including your entire #request document. If that document depends in turn on the output of an oxf:request processor that contains the *whole* request, then as you say whenever anything in the request changes caching will be invalidated. On the other hand, if your oxf:request processor produces only what you need (using the include and exclude elements in its configuration), then caching should occur, because oxf:request correctly digests its output for cache validation. One bottom line for this message: caching is tricky! Maybe somebody could write an OPS pipeline cache analyser in XForms? That would surely be quite welcome ;-) -Erik -- Orbeon - XForms Everywhere: http://www.orbeon.com/blog/ -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |