return the key as string is preferrable IMO, because most components work this 
way. It is like the key in a hashmap. You are free to use whatever, but I 
frequently go for a string. Also realize you have the overhead of the object 
DctmObjectCacheKey if you are not using the toString (suppose you extend it and 
you need some other cocoon component in it....and you forget to set the attr to 
transient..)
 
just go for the string :-) 
 
Ard
 

--

Hippo
Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel  +31 (0)20 5224466
-------------------------------------------------------------
[EMAIL PROTECTED] / [EMAIL PROTECTED] /    <http://www.hippo.nl/> 
http://www.hippo.nl
-------------------------------------------------------------- 

-----Original Message-----
From: Edward S [mailto:[EMAIL PROTECTED]
Posted At: maandag 30 juli 2007 22:25
Posted To: Cocoon User List
Conversation: Cocoon Caching
Subject: Re: Cocoon Caching


thanks Ard.
There was no way I could have figured that out.
 
Yup..I did not implement the equals or hashcode method.  
the toString works now. However, what do you think is a better implementation??
returing the toString as the key or implementing a hashcode method and just 
returning the key?
 
-S2.


 
On 7/30/07, Ard Schrijvers < [EMAIL PROTECTED]> wrote: 

Your problem seems to be very simple: what you see in the statusPage is the 
toString() of all keys. 
 
Your key is of type 
 
protected DctmObjectCacheKey key;
 
So, although all strings in the key are the same, this doesn't neccessarily 
mean they (and most likely are not) return equals and the same hashcode (did 
you implement hashcode and equals in DctmObjectCacheKey ...? I guess not, 
right?) 
 
So, in your generator, return instead of key, the string value of the key, and 
you will see everything will work like you want!!
 
Ard
 
ps the hashcode and equals has obviously nothing to do with cocoon or ehcache, 
but is plain old java logic for putting key,value pairs in hashmaps

 

--

Hippo
Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel  +31 (0)20 5224466
-------------------------------------------------------------
[EMAIL PROTECTED] / http://www.hippo.nl <http://www.hippo.nl/> 
-------------------------------------------------------------- 

-----Original Message-----
From: Edward S [mailto:  <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
Posted At: maandag 30 juli 2007 21:19
Posted To: Cocoon User List
Conversation: Cocoon Caching
Subject: Re: Cocoon Caching



thanks Grzegorz
I did check that.
Everytime I run the URL which is calling the cacheable generator that I wrote, 
a new entry gets added to 

org.apache.cocoon.components.store.impl.EHDefaultStore (hash = 0x5ed853)

and the entry is exactly same as the previous one.
here is a sample entry:

PK_G-imDMXMLContentGenerator-Uri: /EMC/dctm/object/xml Object Id: 
09002ee180005504 Contains Object Id: true Include Dctm. Attributes: true 
Download Support Docs: false Include External References: false_S-xml-1 (class: 
org.apache.cocoon.caching.CachedResponse)
 
 
 



Reply via email to