> Gregor J. Rothfuss wrote:
> > as i said in the other thread, the naive caching with the work
> > directory makes this impossible. in my opinion, it should be removed
> > from lenya.
On 6/17/05, Michael Wechner <[EMAIL PROTECTED]> 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:
1. When a visitor is logged in.
2. When there is a querystring.

if isLoggedIn:
   Goto normalPipelineWithoutCache
end if
if hasQuerystring: 
   Goto normalPipelineWithoutCache
end if
if Cached:
   useCache
   return
end if
Goto normalPipelineWithoutCache

Here is the code.  I'll put it in Bugzilla now.  Just 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="html"/>
</map:match>

<map:match pattern="**.html">
   <map:act type="language-exists">
      <!-- isLoggedIn? -->
      <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>
      <!-- hasQueryString? -->
      <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>

solprovider

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

Reply via email to