On 11 Aug 2003 at 12:16, Upayavira wrote: > On 11 Aug 2003 at 12:06, Carsten Ziegeler wrote: > > > Upayavira wrote: > > > > > > I've been exploring how to get the CLI to use Cocoon's caching > > > mechanism and environment.isLastModified() to prevent the CLI > > > from generating otherwise cached pages. > > > > > > The problem I currently have is that the cache Cocoon uses is > > > transient, and is thus lost every time the CLI restarts. > > > > > > So: > > > a) How can I switch Cocoon to always use a Persistent cache? > > > Putting > > > <cache><parameter name="store" > > > value="org.apache.excalibur.store.Store"/></cache> into > > > cocoon.xconf makes CacheImpl pick a persistent store, but for > > > some reason values aren't in the store after Cocoon has been > > > restarted. > > > What do you mean by "after Cocoon has been restarted"? I'm not sure > > but it could be possible that the store is cleaned on startup. > > All I know is that, when the store is transient, the first page that > is loaded isn't in the cache. And, when I switch to the persistent > store using the cocoon.xconf <cache> element, the persistent store is > picked by CacheImpl, but still the first page isn't in the cache, even > after multiple runs. > > By "after Cocoon has restarted" I'm referring to the fact that, each > time you invoke the CLI, Cocoon starts up from scratch, does its work, > and then shuts down. So anything in a transient cache presumably won't > survive between invocations of the CLI. > > > > b) How can I get Cocoon to use a persisitent store for CLI and a > > > transient one for servlet? > > > > > By using different configurations, ok dumb answer I know, but the > > easiest (?) solution is to change the above mentioned store > > parameter to the required values. > > Not dumb. But I tried it, but the page still wasn't in the cache after > Cocoon had restarted (through debugging in Eclipse), and I could see > that CacheImpl was loading a DefaultStore rather than a > MRUMemoryStore. And default store is based upon Jisp, which is > persistent, no? > > I'll have more of a look this evening to see if I can spot why it > isn't working. Can you give me any pointers to where I should look? > > Thanks for your help here. I'm pretty green when it comes to caching > in Cocoon, but I'm improving rapidly!
I've just done a further check which makes this problem easier to see: 1) add the <cache><parameter name="store" value="org.apache.excalibur.store.Store"/> </cache> thing to cocoon.xconf. 2) Start Cocoon in Jetty 3) Load a page to get something into the cache, e.g: http://localhost:8888/samples/hello-world/ 4) Go to http://localhost:8888/samples/status.html and you'll see your pages in the default store. Correct. 5) Shut down Jetty and restart 6) Go back to http://localhost:8888/samples/status.html and you're pages have disappeared from the default store. Surely this is wrong! Regards, Upayavira
