The server takes care of all that, automatically. You can see whether or not a particular document access was cached by calling xdmp:query-meters() at the end of your query. Look for 'expanded-tree-cache-hits', which are summarized at the top and also detailed per-document.

-- Mike

On 2009-08-03 12:45, Runstein, Robert E. (Contr) (IS) wrote:
Thanks for the below suggestion to reduce the number of passes through
the lookup document.  Is there a mechanism I can use to cache the lookup
document so that I only need to read the fragment into memory once
rather than for each incoming document that needs to be processed?  It
would need to have a way to periodically invalidate the cache since the
lookup document can change.

Bob



Robert,

There's a difference, and I'd expect the expression without the 'where'
to be more efficient. But within a single (unfragmented) doc, it doesn't
matter much because the entire fragment will end up in memory either
way. You could profile the query to see.

But I think there's room for improvement. Here's how I'd write that
query:

    doc($lookup-uri)/value-list/values[key = $keys]

First, it's almost always more efficient to specify a complete XPath
than to use '//'. Next, turned the for-expression over $keys into a
simple predicate lookup with multiple values. This works because '=' is
a list-comparison operator, and should result in one pass through the
document rather than N passes.

As Geert mentioned, you might also consider using a map
(http://developer.marklogic.com/pubs/4.1/apidocs/map.html).
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general

Reply via email to