DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35407>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=35407

           Summary: Disable caching if loggedIn or has querystring
           Product: Lenya
           Version: 1.2.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Default Publication
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


> Gregor J. Rothfuss wrote "The naive caching with the work directory makes this
[dynamic pages] impossible. In my opinion, it should be removed from lenya."
On 6/17/05, Michael Wechner wrote, "In productive environments with heavy load
it's very useful.  Why don't we just DISABLE it by default instead of removing 
it?"

Caching seems very useful, but is incompatible with dynamic sites.  Disable it 
when:
1. A visitor is logged in.  (My menus change when a visitor logs in.)
2. There is a querystring (for Usecases and other fun.  Imagine if the Search
page was cached so the same results showed for any request.)

That leaves regular URLs for non-loggedIn visitors.  That will at least speed
the homepage, and may help elsewhere.

In publication-sitemap.xmap, replace:
<map:match pattern="**.html">
...
</map:match>

With:

<map:match pattern="**.nocache">
   <map:generate
src="cocoon:/lenyabody-view/{page-envelope:publication-id}/{page-envelope:area}/{page-envelope:document-type}{page-envelope:document-url}"/>
     <map:match pattern="authoring/**.nocache">
        <map:transform
src="cocoon://lenya-page/{page-envelope:publication-id}/{../1}.xml?doctype={page-envelope:document-type}"/>
     </map:match>
     <map:transform src="../../xslt/util/strip_namespaces.xsl"/>
     <map:match pattern="live/**.nocache">
         <map:transform src="../../xslt/authoring/edit/addSourceTags.xsl">
             <map:parameter name="source" 
value="{global:cache-dir}/live/{1}.html"/>
         </map:transform>
         <map:transform type="write-source">
             <map:parameter name="serializer" value="html-no-dtd"/>
         </map:transform>
         <map:transform src="../../xslt/authoring/edit/removeSourceTags.xsl"/>
      </map:match>
   <map:serialize type="xml"/>
</map:match>

<map:match pattern="**.html">
   <map:act type="language-exists">
      <!-- Is visitor logged in? -->
      <map:select type="parameter">
         <map:parameter name="parameter-selector-test"
value="{access-control:user-id}"/>
         <map:when test="">
         </map:when>
        <map:otherwise>
           <map:generate src="cocoon:/{../1}.nocache"/>
           <map:serialize type="html"/>
        </map:otherwise>
      </map:select>
      <!-- Has querystring? -->
      <map:select type="parameter">
         <map:parameter name="parameter-selector-test"
value="{request:queryString}"/>
         <map:when test="">
         </map:when>
        <map:otherwise>
           <map:generate src="cocoon:/{../1}.nocache"/>
           <map:serialize type="html"/>
        </map:otherwise>
      </map:select>
      <map:select type="resource-exists">
        <!-- Check Cache -->
        <map:when test="{global:cache-dir}/{../1}.html">
           <map:read src="{global:cache-dir}/{../1}.html" 
mime-type="text/html"/>
        </map:when>
        <map:otherwise>
           <map:generate src="cocoon:/{../1}.nocache"/>
           <map:serialize type="html"/>
        </map:otherwise>
      </map:select>
   </map:act>
   <!-- There is no version of the requested document-id for the requested
language. -->
   <map:generate type="serverpages"
src="../../content/exception/missing-language.xsp"/>
   <map:transform src="../../xslt/exception/missing-language.xsl"/>
   <map:call resource="style-cms-page"/>
</map:match>

This has been alpha tested.  There were a few changes from the user-ML post. 
Someone else should test before committing.

solprovider

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to