AW: [opencms-dev] Caching in the Navigation class

Andreas Schouten Andreas.Schouten at framfab.de
Fri Oct 19 11:38:54 CEST 2001


Hi,

you can use the element and variant cache for your probelm. Add the
following lines to your navigation class:

    /**
     * gets the caching information from the current template class.
     *
     * @param cms CmsObject Object for accessing system resources
     * @param templateFile Filename of the template file
     * @param elementName Element name of this template in our parent
template.
     * @param parameters Hashtable with all template class parameters.
     * @param templateSelector template section that should be processed.
     * @return <EM>true</EM> if this class may stream it's results,
<EM>false</EM> otherwise.
     */
    public CmsCacheDirectives getCacheDirectives(CmsObject cms, String
templateFile, String elementName, Hashtable parameters, String
templateSelector) {

        // First build our own cache directives.
        CmsCacheDirectives result = new CmsCacheDirectives(true);
        result.setCacheUri(true);
        result.renewAfterEveryPublish();
        return result;
    }

Now the output of your class should be cached. You can see this as an
example in com.opencms.defaults.CmsXmlNav

Regards,
Andreas

-----Ursprüngliche Nachricht-----
Von: Oliver Faulhaber [mailto:ofh3 at hotmail.com]
Gesendet: Freitag, 19. Oktober 2001 11:19
An: opencms-dev at opencms.com
Betreff: [opencms-dev] Caching in the Navigation class


Hi OpenCms-Developers

at the moment we work on a OpenCms project with a complex HTML Frontend.

By requesting a page within this project, the method getNavFold() is 
executed five times in our navigation class (due to the HTML structure of a 
page)

The method getNavFold() uses, among other things, the method 
getSubFolders(String folder) of the class CmsObject, which needs 25-50 
milliseconds for its execution on our systems.

Since, as already mentioned, our pages produce above 5 calls of 
getSubFolders(), we get response times within up to 300 milliseconds, which 
naturally represents a very long response time.

Therefore I have taken a look into the OpenCms-classes an have found, in 
getSubFolders(...) in the genericSQL-RessourceBroker, the following comment:

   // Todo: add caching for getSubFolders
   // 
folders=(Vector)m_subresCache.get(C_FOLDER+currentProject.getId()+foldername
);

;)

we would be very glad, if in one of the next releases this caching were 
implemented. This would accelerate our project dramatically.

Thank you and many greetings
Oliver Faulhaber

_________________________________________________________________
Downloaden Sie MSN Explorer kostenlos unter http://explorer.msn.de/intl.asp



More information about the opencms-dev mailing list