cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vadim Gritsenko <vadim.gritse...@verizon.net>
Subject Re: CaheValidity & toString()
Date Tue, 29 Oct 2002 00:26:11 GMT
Stephen Ng wrote:

>>... which means that these two URLs produce different 
>>Validity objects 
>>in from-an-xsp pipeline. Is it right?
>>But what about validity? Seems that it changes.
>>
>>    
>>
>
>Yes the validity changes, but ContentAggregator's key is the same.
>

Yes, of course.


>  If
>two objects have the same Key, it looks like only the second one
>

It's not second one, it's *the* *same* object. Equal keys == same 
object. See cacheable.xsp to get an idea, it shows how with the help of 
a single XSP you can create multiple objects (with different keys). In 
cacheable.xsp, every different value of the request parameter 'param' 
will create different object (in the cache).



> is
>stored/retrieved from the cache.
>
>  
>
>>Right now it has:
>>                        key += HashUtil.hash("P=" +
>>                                         part.stripRootElement + ':' +
>>                                         current.getSystemId() + ';');
>>
>>And that is correct.
>>
>>    
>>
>
>Yes, I mean to add my change *after* the other lines, so that
>getLastModified is part of the key.  Here is the whole section:
>
>                if (current.getLastModified() == 0) {
>                        return 0;
>                } else {
>                    if (part.element == null) {
>                        key += HashUtil.hash("P=" +
>                                         part.stripRootElement + ':' +
>                                         current.getSystemId() + ';');
>                    } else {
>                        key += HashUtil.hash("P=" +
>                                         part.element.prefix +
>                                         ':' +
>                                         part.element.name +
>                                         '<' + part.element.namespace +
>">:" +
>                                         part.stripRootElement + ':' +
>                                         current.getSystemId() + ';');
>                    }
>                    key += current.getLastModified();  // <-- ADD THIS
>LINE
>                }
>
>If this still doesn't make sense, I will take a moment to try to
>reproduce this in the standard 2.0.3 distribution....
>

I think you had confusion here. Main point is:
  Key identfies object,
  Validity represents *status* of this object (changed - need to be 
re-generated / not changed - can serve from cache).

Thus, to create several objects, simply generate different keys.


Vadim


>Steve
>  
>


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


Mime
View raw message