cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <a.schrijv...@hippo.nl>
Subject RE: Cache (persistence & performance)
Date Tue, 17 Apr 2007 06:28:04 GMT
Hello Dan,

> 
> Hi!
> 
> I have been trying for a few days now to find out where (and 
> if) Cocoon persists
> the cached XML chunks obtained from pipelines. Almost all of 
> the pipelines I've
> written implement CacheableProccessingComponent. 

You mean all your compoments in a pipeline implement CacheableProccessingComponent. If one
does not,
your cocoon caches untill the first not cacheable transformer (if the generator does not cache,
nothing gets cached. Also, implementing CacheableProccessingComponent is no garantuee for
a proper working
cache of your component. The cachekey and validity object do have to make sense! [1] )

> I read 
> something about a
> <persistent-store> tag in cocoon.xconf, but I didn't 
> understand much. 

A persistent-store...just to be sure, means that you want a cache that is persistent between
JVM restarts, right? If you are using EHCache, 
you can see in this code snippet where it stores the cached responses (if you use EHCache):

	try {
            if (parameters.getParameterAsBoolean("use-cache-directory", false)) {
                if (this.getLogger().isDebugEnabled()) {
                    getLogger().debug("Using cache directory: " + cacheDir);
                }
                setDirectory(cacheDir);
            }
            else if (parameters.getParameterAsBoolean("use-work-directory", false)) {
                if (this.getLogger().isDebugEnabled()) {
                    getLogger().debug("Using work directory: " + workDir);
                }
                setDirectory(workDir);
            }
            else if (parameters.getParameter("directory", null) != null) {
                String dir = parameters.getParameter("directory");
                dir = IOUtils.getContextFilePath(workDir.getPath(), dir);
                if (this.getLogger().isDebugEnabled()) {
                    getLogger().debug("Using directory: " + dir);
                }
                setDirectory(new File(dir));
            }
            else {
                try {
                    // Legacy: use working directory by default
                    setDirectory(workDir);
                } catch (IOException e) {
                }
            }
        } catch (IOException e) {
            throw new ParameterException("Unable to set directory", e);
        }

in cocoon.xconf, you can set in the ehcache store configuration, <parameter name="diskpersistent"
value="true"/>


> Can you
> please tell me how, or at least where is Cocoon persisting 
> its cache and is
> there a way to redirect this persistence (say to a DB)?

To a DB....I would use a Cache which is capable of persisting in a DB (JCS can, I suppose
EHCache also)

> 
> And another thing... Can you please tell me what parameters 
> do I need to modify
> in order to temper with Cocoon's cache performance.

?? what do you mean? Anyway, the cache parameters are in cocoon.xconf in <store>. You
can find this on the wiki

> 
> P.S. By Cocoon's cache, I understand cached versions of a XML 
> generated
> response. Is this correct? Maybe I got it all wrong...

Hmmm, more or less you could see it that way (though it is more subtle, look at CachedResponse
if you want to know more...also look at your 
localhost:port/status page to see which cachekeys are created)

> 
> Many thanks!

Regards Ard

[1] http://cocoon.zones.apache.org/daisy/cdocs/g1/g1/g7/690.html

> 
> Dan
> 
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message