You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Michael Cortez <mc...@fullcoll.edu> on 2002/05/10 21:01:42 UTC

RE: caching proposals

What I'd like to see is a flag that I can use to mark a map as cached and
the ability to specify a time-out.

For example:


<map:match pattern="test/*">
    <map:generate src="xmldb:xindice://localhost:4080/db/test/{1}"/>
    <map:serialize type="xml"/>
    <map:cache timeout="300" regenerate="async"/>
</map:match>

In this case, what'ever is returned by "test", no matter what it is or how
it was generated would be cached for 300 seconds.  The map wouldn't even try
to check to see if the source data has changed.

Also, after the 300 seconds (5 minutes) has elapsed, the next call to the
map will cause a new data set to be created either Synchronously making the
caller wait, or Asynchronously thus allowing the caller to continue on his
way without having to wait for the data to be re-created.

Incoherent babbling on my thoughts of implementing this using xsp and
java...

I've thought of doing this in XSP using Java, by storing the request URI
stored into a hash table with a calculated timeout, and the name of a file.
The first request to the map generates a file for the cache and writes out
the result of the pipeline to that file.  It then stores the calling URI,
calculated expiration date/time, and filename to the hashtable.  Subsequent
calls to the same map check against the hashtable, if the URI is not present
it generates it for the first time, if it is present and the time-out has
not expired it feeds back to the caller the cached file, if the timeout has
expired it starts a new thread to generate a new cache file (when that
thread completes it resets the hashtable to point to the new file) in the
mean time the cached file is returned to the caller.

Anyone interested in such a beast?

--
Mike

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>