>If you have time, you can try to analyze the whole caching picture,
including aggregation, sources, and C/X includes.

Ha! No, not yet.  Maybe after I've used Cocoon a little longer I'll be
more comfortable tackling it.  Meanwhile I will put in my little object
check in my code so I don't worry about the clash problem for now.

Steve

> -----Original Message-----
> From: Vadim Gritsenko [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, April 19, 2002 2:47 PM
> To: Stephen Ng
> Cc: [EMAIL PROTECTED]
> Subject: RE: Cocoon cache hash clash
> 
> 
> > From: Stephen Ng [mailto:[EMAIL PROTECTED]]
> > 
> > So CacheValidity objects should always take an extra Object 
> parameter, 
> > which contains the string or whatever key is being hashed.  The
> isValid
> > function would then not just do its usual validity 
> checking, it should 
> > also check the equality of those objects.
> > 
> > To be explicit, we could rewrite TimeStampCacheValidity to be hash
> clash
> > safe as follows:
> > 
> >     private Object realKey;  // the other key is "just" a 
> hash which 
> > fits in a long.
> > 
> >     public TimeStampCacheValidity(long timeStamp, Object realKey) {
> >         this.timeStamp = timeStamp;
> >       this.realKey = realKey;
> >     }
> > 
> >     public boolean isValid(CacheValidity validity) {
> >         if (validity instanceof TimeStampCacheValidity) {
> >             return this.timeStamp ==
> > ((TimeStampCacheValidity)validity).getTimeStamp() &&
> >                     this.realKey.equals(validity.realKey);
> >         }
> >         return false;
> >     }
> > 
> > Would this (or something like it since I haven't even 
> compiled this) 
> > work?
> 
> This has good chances to work; also I'm not (yet?) sure I 
> like this solution.
> 
> 
> > Or is something better planned for a future (imminent) release of 
> > Cocoon? (I didn't have any luck searching for the bug or 
> TODO that you
> > mentioned)
> 
> It is planned to be fixed, also it is not discussed how it 
> will be fixed. Bug related to the caching is:
> 
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4641
> 
> And TODO item (related to caching) is:
> 
> http://cvs.apache.org/viewcvs.cgi/xml-cocoon2/todo.xml?rev=1.2
> 8&content-
> type=text/vnd.viewcvs-markup:
> 
> <action context="code" assigned-to="open">
>    Fix lastModificationDate() method misuse. Instead of 
> modificationDate,
>    sometimes generated hash value is being returned, and instead of
>    comaring dates on before/after, they are compared on equality.
>    See 
> http://marc.theaimsgroup.com/?l=xml-cocoon-dev&amp;m=997807082
> 22079&amp;
> w=2
>    and 
> http://marc.theaimsgroup.com/?l=xml-cocoon-dev&amp;m=998142169
> 23705&amp;
> w=2
>    for more information on this issue.
>   </action>
> 
> If you have time, you can try to analyze the whole caching 
> picture, including aggregation, sources, and C/X includes.
> 
> Vadim
> 
>  
> > Many thanks,
> > 
> > Steve
> > 
> > > -----Original Message-----
> > > From: Vadim Gritsenko [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, April 19, 2002 2:05 PM
> > > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > > Subject: RE: Cocoon cache hash clash
> > >
> > >
> > > > From: Stephen Ng [mailto:[EMAIL PROTECTED]]
> > > >
> > > > I'm confused by coocoon caching--what if I have use 
> HashUtil in my 
> > > > generateKey, and two different pages/request happen to generate
> the
> > > same
> > > > hash key?  Won't cocoon erroneously return the same 
> page from the
> > > cache?
> > >
> > > Only if validity matches. But it usually does not - 
> result is that 
> > > these two pages won't be cached at all. Luckily, this
> > > (almost) does not happen.
> > >
> > > There is a bug and a TODO item on this theme.
> > >
> > > Vadim
> > >
> > >
> > > > Steve Ng
> > > > Lumigent
> 
> 
> ---------------------------------------------------------------------
> 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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>


---------------------------------------------------------------------
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: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to