You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Johannes Lichtenberger <Jo...@uni-konstanz.de> on 2010/03/22 21:30:16 UTC

Bug in Cocoon-Caching?

Hi,

I've written generators, and caching generators which extend the
non-caching components and implement CachingPipelineComponent. The
isValid(CacheKey) method is as follows:

  /**
   * Check if caching period expired.
   *
   * @see
org.apache.cocoon.pipeline.caching.AbstractCacheKey#isValid(CacheKey)
   */
  @Override
  public boolean isValid(final CacheKey other) {
    if (!(other instanceof FileCaching)) {
      return false;
    }

    final FileCaching otherCacheKey =
        (FileCaching) other;
    return this.mTimestamp == otherCacheKey.mTimestamp;
  }

Basically mTimestamp is the last timestamp a file has been modified
(file.lastModified()). I assume that's correct, but it always responds
with the same file even if it changes:

    <map:pipeline jmx-group-name="timestamp-caching">
      <map:match pattern="caching-pipeline/on">
        <map:generate type="cachingttsax" src="test"/>
        <map:serialize/>
      </map:match>
    </map:pipeline>
    
    <map:pipeline type="async-caching" jmx-group-name="async-caching">
      <map:match pattern="async-caching-pipeline/on">
        <map:generate type="cachingttsax" src="test"/>
        <map:serialize type="xml"/>
      </map:match>
    </map:pipeline>

Even from within another pipeline.

regards,
Johannes

    <map:pipeline type="noncaching" jmx-group-name="nocaching">
      <map:match pattern="caching-pipeline/off">
        <map:generate type="cachingttsax" src="test"/>
        <map:serialize type="xml"/>
      </map:match>
    </map:pipeline>


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


Re: Bug in Cocoon-Caching?

Posted by Johannes Lichtenberger <Jo...@uni-konstanz.de>.
On Tue, 2010-03-23 at 02:31 +0100, Jos Snellings wrote:
> This was not a bug. I observed that caching pipelines produce this only
> if they end in an XML serialization. This behaviour was strange and
> misleading.
> However, the cause was the 'cacheKey' the generator returned was the
> "simpleCacheKey" which had been sitting there from the examples.
> Replacing SimpleCacheKey by ParameterCacheKey solved the problem.
> Have a look at the routine! Maybe this removes your problem.
> I suggested to replace this in the examples.

I don't think so, I've implemented my own caching component but it seems
it's always caching (ok, I copied the examples in the caching section
and replaced the XMLGenerator with my generator).

I replaced the file/folder and it always returned the cached version
until I restarted jetty.

regards,
Johannes


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


Re: Bug in Cocoon-Caching?

Posted by Jos Snellings <Jo...@pandora.be>.
This was not a bug. I observed that caching pipelines produce this only
if they end in an XML serialization. This behaviour was strange and
misleading.
However, the cause was the 'cacheKey' the generator returned was the
"simpleCacheKey" which had been sitting there from the examples.
Replacing SimpleCacheKey by ParameterCacheKey solved the problem.
Have a look at the routine! Maybe this removes your problem.
I suggested to replace this in the examples.

Hope this helps,
Jos



On Mon, 2010-03-22 at 21:33 +0100, Johannes Lichtenberger wrote: 
> I think it could be related to the bug Jos Snellings posted some time
> ago where always the first execution in pipeline with type="xml" 
> serializers is beeing executed.
> 
> 
> 
> ---------------------------------------------------------------------
> 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


Re: Bug in Cocoon-Caching?

Posted by Johannes Lichtenberger <Jo...@uni-konstanz.de>.
I think it could be related to the bug Jos Snellings posted some time
ago where always the first execution in pipeline with type="xml"
serializers is beeing executed.



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