cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Upayavira" ...@upaya.co.uk>
Subject Re: Switching cache to Persistent Store
Date Mon, 11 Aug 2003 19:36:13 GMT
<?xml  version="1.0" ?><html>
<head>
<title></title>
</head>
<body>
<div align="left"><font face="Arial"><span style="font-size:10pt">Geoff,</span></font></div>
<div align="left"><br/></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
&gt; The work dir is configured in the cli.xconf, and is simply created</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
&gt; with new File(workDir). The cache directory is made from the work</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
&gt; dir with cache-dir appended.</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
Sorry for my ignorance - I don't see any caching set up in cli.xconf,</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
so I assume that means you are inheriting the definitions from</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
cocoon.xconf?&#160; That eliminates one class of problems (unless you're</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
not using the default cocoon.xconf - if that's the case, send your</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
transient and peristent store decl. declaration here</span></font></div>
<div align="left"><br/></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">No, it
inherits from cocoon.xconf.</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt"> </span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
I noticed you have &lt;work-dir&gt;../temp/docs&lt;/work-dir&gt;</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
After a run of the cli is that dir (really the cache dir under it)</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
empty?</span></font></div>
<div align="left"><br/></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">The cli.xconf
is configured to drive the documentation webapp, not the default one, so 
it's a little strange. At some point I'll move that one into the documentation system 
and create a more natural one in the root. I've simply got &lt;work-dir&gt;work&lt;/work-dir&gt;

which creates $COCOON-2.1/work.</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt"> </span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
&gt; Once I worked out what was going on with your EventCache, I removed</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
&gt; it, and it made no difference. </span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
Whew.</span></font></div>
<div align="left"><br/></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">:-) </span></font></div>
<div align="left"><br/></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
&gt; Removing it enabled me to get it to switch to using a persistent</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
&gt; store by putting a &lt;cache&gt; element into cocoon.xconf, but the is</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
&gt; persistent store (DefaultStore) doesn't survive a restart of the</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
&gt; CLI, either, i.e. the first store.get() returns nothing and the</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
&gt; second store.get() does.</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
Huh?</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
- No cache element is needed in cocoon.xconf because it's defined in</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
cocoon.roles (and if you just removed the event-cache by deleting the</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
xconf entry you probably didn't really remove it) - The cache role is</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
a wrapper around transient-store and persistent-store which come</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
predifined in cocoon.xconf</span></font></div>
<div align="left"><br/></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Okay.
All I was doing was switching from transient to persistent, but your explanation 
below tells me I don't need to do that.</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt"> </span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
These components work together like this:</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
Cache wraps transient-store which uses persistent-store (if and only</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
if *&lt;parameter name=&quot;use-persistent-cache&quot; value=&quot;true&quot;/&gt;
is set on</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
transient-store in cocoon.xconf which it is by default)</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
All new items go into the transient-store, and if configured, older</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
items are moved into persistent-store when they are bumped off the</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
bottom of the stack, or on container shutdown.&#160; All this happens by</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
default out of the box and is working correctly (unless you</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
delete/fail to reuse the cache-dir as Jetty does) for the servlet</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
mode.</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">As far
as I can see, I reuse the cache-dir. Or at least, there's a file in the cache-dir 
that gets updated, and I use the same cache-dir each time.</span></font></div>
<div align="left"><br/></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
Sorry if that is all obvious to you but that last paragraph makes me</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
think you've got some things turned around in your head - probably</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&gt;
because of the Jetty behavior.</span></font></div>
<div align="left"><br/></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">I had
got some things wrong, but the Jetty behaviour only went to prove my wrong 
understanding, rather than convince me otherwise!</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Anyway,
I've done some more research, including downloading the source for Avalon 
(for the first time!) and stepped through the code for the Store. </span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">I don't
know if this is a problem, but in AbstractJispFilesystemStore, the get and store 
methods don't seem to match up:</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">get():</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">value
= m_Database.read(this.wrapKeyObject(key), m_Index);</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">and</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">store():</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">KeyObject[]
keyArray = new KeyObject[1];</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
keyArray[0] = this.wrapKeyObject(key);</span></font></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;
m_Database.write(keyArray, 
(Serializable) value);</span></font></div>
<div align="left"><br/></div>
<div align="left"><font face="Arial"><span style="font-size:10pt">So one
uses a wrapped key object, and the other uses an array of wrapped key 
objects with one element. Does this mean it's not using the same key, and thus can 
never get at stuff in the persistent store? Is this correct?</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">[I've
still to work out how to compile Avalon, so I can't try it myself yet!]</span></font></div>
<div align="left"><br/>
</div>
<div align="left"><font face="Arial"><span style="font-size:10pt">Regards,
Upayavira</span></font></div>
<div align="left"><br/>
</div>
<div align="left"></div>
</body>
</html>

Mime
View raw message