You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by toto <en...@free.fr> on 2004/03/03 20:37:34 UTC

caching - getValidity()

Hi,

    i'm having trouble with the getValidity() method.
i'd like to invalidate the cached response under certain condition :

public SourceValidity getValidity() {
    if (externalCondition) {
        return null;
    } else {
        return new NOPValidity();
    }
}

however, once  NOPValidity is returned, the validity of the cached response
is never checked again  (unless the new and the cached keys differ). So, 
how
can i have the validiy checked everytime the component is used?

thnx in advance


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


AW: caching - getValidity()

Posted by Marco Rolappe <m_...@web.de>.
hi toto,

1. if you use NOPValidity avoid garbage creation by using the shared
singleton instance (NOPValidity.SHARED_INSTANCE IIRC)
2. you seem to misunderstand how SourceValidity's are supposed to work.
Validity here should probably better be called Validator, since
SourceValidity's responsibility is to function as cache (entry) validator.
anyway, you are performing that 'is the entry valid?' in your getValidity()
method by checking an external condition, so that's wrong (design-wise);
move that logic into the validator/SourceValidity. this might require a
custom SourceValidity, of course.

> -----Ursprungliche Nachricht-----
> Von: users-return-63975-m_rolappe=web.de@cocoon.apache.org
> [mailto:users-return-63975-m_rolappe=web.de@cocoon.apache.org]Im Auftrag
> von toto
> Gesendet: Mittwoch, 3. Marz 2004 20:38
> An: users@cocoon.apache.org
> Betreff: caching - getValidity()
>
>
> Hi,
>
>     i'm having trouble with the getValidity() method.
> i'd like to invalidate the cached response under certain condition :
>
> public SourceValidity getValidity() {
>     if (externalCondition) {
>         return null;
>     } else {
>         return new NOPValidity();
>     }
> }
>
> however, once  NOPValidity is returned, the validity of the
> cached response
> is never checked again  (unless the new and the cached keys differ). So,
> how
> can i have the validiy checked everytime the component is used?
>
> thnx in advance
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


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