You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Lee Carroll <le...@aol.com> on 2006/02/08 10:17:27 UTC

clear cache for a page or publication

Hi,
I've implemented the cocoon clear-cache for an instance of Lenya. This 
is needed as a publication includes several page fragments using the 
cinclude mechanism which do not "re-fresh" after editing. (a fragment 
gets edited but the page served contains the cahced version of the 
fragment.) The  idea  of the clear cache was to allow content editors 
the ability to "refresh the page" after editing.

However the clear cache clears the cache for all publications. This is a 
bad thing. Has anyone limited the clear cache to a particular 
publication or a particular page ?

Thanks in advance

Lee C

Clear cache implemented is :


<map:action name="clear-cache" logger="sitemap.action.clear-cache" 
src="org.apache.cocoon.acting.ClearCacheAction"/>

<!-- clear cache  -->
   <map:match pattern="clearcache.html">
    <map:act type="clear-cache">
       <map:generate src="status" type="status"/>
       <map:serialize type="xml"/>
    </map:act>
   </map:match>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


RE: clear cache for a page or publication

Posted by Josias Thoeny <jo...@wyona.com>.
On Wed, 2006-02-08 at 20:39 +0000, Lee Carroll wrote:
> 
> Josias wrote
> 
> 
> 
> >Maybe the caching happens in the pipeline which serves the fragments to be
> >included? Would it be an option for you to set the pipeline to noncaching
> >(<map:pipeline type="noncaching">) ?
> 
> 
> Yes thats where the caching is happening. Ideally I'd like the content
> editor to have an option in the edit menu on the
> authoring tab to "re-fresh page". This would clear the cache entry for the
> current page being viewed in the authoring tab.

Can you send us the sitemap snippet containing this pipeline?
If it's a simple pipeline with something like <map:generate
src="the-fragment.xml"> the last-modified date of the xml file should be
checked and you should always get the updated version. 


> 
> I've had a quick look in the api docs and it would appear from first look
> that this might be possible. Am I doomed to failure on this or should it be
> easy enough. I can just about coble together an xsp.

It looks like it should be possible to remove a cached response for a
certain key from the cache. But I don't know how to get the correct key.

But first I would try to play around with the pipelines...

BTW, which version of Lenya/Cocoon are you using?

Josias

> 
> Lee C
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
> For additional commands, e-mail: user-help@lenya.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


RE: clear cache for a page or publication

Posted by Lee Carroll <le...@pear-partnership.co.uk>.

Josias wrote



>Maybe the caching happens in the pipeline which serves the fragments to be
>included? Would it be an option for you to set the pipeline to noncaching
>(<map:pipeline type="noncaching">) ?


Yes thats where the caching is happening. Ideally I'd like the content
editor to have an option in the edit menu on the
authoring tab to "re-fresh page". This would clear the cache entry for the
current page being viewed in the authoring tab.

I've had a quick look in the api docs and it would appear from first look
that this might be possible. Am I doomed to failure on this or should it be
easy enough. I can just about coble together an xsp.

Lee C





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: clear cache for a page or publication

Posted by Josias Thoeny <jo...@wyona.com>.
> Hi,
> I've implemented the cocoon clear-cache for an instance of Lenya. This
> is needed as a publication includes several page fragments using the
> cinclude mechanism which do not "re-fresh" after editing. (a fragment
> gets edited but the page served contains the cahced version of the
> fragment.) The  idea  of the clear cache was to allow content editors
> the ability to "refresh the page" after editing.
>
> However the clear cache clears the cache for all publications. This is a
> bad thing. Has anyone limited the clear cache to a particular
> publication or a particular page ?

Hi Lee,

Sorry, I don't know how to clear only one part of the cache...
But I think it should be possible to get the updated page without deleting
the cache.
IIRC the cinclude transformer shouldn't do any caching unless it's
explicitely configured to so, see also the section about caching in:
http://cocoon.apache.org/2.1/userdocs/cinclude-transformer.html

Maybe the caching happens in the pipeline which serves the fragments to be
included? Would it be an option for you to set the pipeline to noncaching
(<map:pipeline type="noncaching">) ?

If you find out where exactly the caching happens, it may give you a hint
about what's going wrong.

Josias



>
> Thanks in advance
>
> Lee C
>
> Clear cache implemented is :
>
>
> <map:action name="clear-cache" logger="sitemap.action.clear-cache"
> src="org.apache.cocoon.acting.ClearCacheAction"/>
>
> <!-- clear cache  -->
>    <map:match pattern="clearcache.html">
>     <map:act type="clear-cache">
>        <map:generate src="status" type="status"/>
>        <map:serialize type="xml"/>
>     </map:act>
>    </map:match>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
> For additional commands, e-mail: user-help@lenya.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: clear cache for a page or publication

Posted by so...@apache.org.
On 2/8/06, Lee Carroll <le...@pear-partnership.co.uk> wrote:
> Solprovider wrote
> >I think you are attacking the issue from the wrong side.  Rather than
> >cache it and then worry about deleting it from cache, why not see it
> >as something dynamic that should never be cached?
>
> Editing is relatively rare compared to page viewing, so seems a shame not to
> take advantage of caching
>
> > Is the processing
> >required to generate this page enough to hurt performance?
> The honest answer is I don't know. However it does save at least 2 extra
> transform and serializations which instinctivelly
> feels like a good thing.

I prefer programming for best performance too.  A few extra transforms
and serializations will not be noticed, but if the page is accessed
often, and editing is rare, it is best if you use the cache.

I have not studied how publishing works.  It sounds like there is no
method for deleting dependencies from the cache.  I can think of a few
alternatives, but none are as good as adding that feature.  (Like
deleting the files from cache after any edit, regardless of whether it
is a dependency.)  Hopefully someone more knowledgeable about
publishing will enter the discussion.

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


RE: clear cache for a page or publication

Posted by Lee Carroll <le...@pear-partnership.co.uk>.
Solprovider wrote

>I think you are attacking the issue from the wrong side.  Rather than
>cache it and then worry about deleting it from cache, why not see it
>as something dynamic that should never be cached?


Editing is relativly rare compared to page viewing, so seems a shame not to
take advantage of caching


> Is the processing
>required to generate this page enough to hurt performance?

The honest answer is I don't know. However it does save at least 2 extra
transform and serilazations which instinctivelly
feels like a good thing.

Cheers Lee C



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Re: clear cache for a page or publication

Posted by so...@apache.org.
On 2/8/06, Lee Carroll <le...@aol.com> wrote:
> I've implemented the cocoon clear-cache for an instance of Lenya. This
> is needed as a publication includes several page fragments using the
> cinclude mechanism which do not "re-fresh" after editing. (a fragment
> gets edited but the page served contains the cached version of the
> fragment.) The  idea  of the clear cache was to allow content editors
> the ability to "refresh the page" after editing.
>
> However the clear cache clears the cache for all publications. This is a
> bad thing. Has anyone limited the clear cache to a particular
> publication or a particular page ?

I think you are attacking the issue from the wrong side.  Rather than
cache it and then worry about deleting it from cache, why not see it
as something dynamic that should never be cached?  Is the processing
required to generate this page enough to hurt performance?

solprovider

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org