[MarkLogic Dev General] How to track collection last modified?
meffords at avalonconsult.com
Thu Jan 26 12:09:09 PST 2012
Is there a good general way to track when a collection was last
modified? I'd like to use this for app-layer (Java) caching of reponses
to complex queries. Rather than re-run queries, I'd like to cache the
responses unless the underlying data has been modified (and thus the
collection last-modified stamp is newer than the one associated with the
I looked at last modified timestamps for the database and directories,
and those might be viable alternatives, but I see no API to get the
values MarkLogic is tracking.
I considered updating a document with the last-modified timestamp each
time a document is updated in the collection, but that could become a
bottleneck when indexing high volumes.
I considered creating a range index on a last-modified timestamp element
on each document and querying it to find out the highest last modified
value. While this may work, I wonder if it's wasted indexing effort and
memory for the range index since the timestamp is about the worst fit
for a range index because very few documents will have the same timestamps.
Anyone ever try something similar? Do you think one of the ideas above
is best, or is there a better way?
Avalon Consulting, LLC
More information about the General