Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-80296

Velocity Template caching is ineffective

    Details

      Description

      Velocity template caching is ineffective due to below issues:

      Steps for debugging

      1. Start the portal and sign in as an administrator.
      2. In the Control Panel, select "Configuration" and "Application Display Template".
      3. Create an "Asset Publisher Template" ADT, name it "Macros", choose Velocity and type in the script "<div>Hello World from Macros</div>".
      4. After creation, take note of the Template Key of the ADT (in our case 33106).
      5. Create another "Asset Publisher Template", name it "Hello World", choose Velocity and type in the script the following :
        #parse("$journalTemplatesPath/33106")
        <div>Hello World from Hello World</div>
      6. Add an asset publisher on the home page and configure it as follows :
        In the Display Settings tab choose "Hello World" as Display Template.
        In the Asset Selection tab, select "Basic Web Content" , create a new one with dummy values and select it.
      7. Put a breakpoint on the method com.liferay.portal.template.DefaultTemplateResourceLoader#_loadFromCache(portalCache, templateId).
      8. Reload the homepage multiple times.
      9. Debug step by step and notice that the template is put multiple times in the cache (method com.liferay.portal.template.velocity.internal.LiferayResourceManager#_getResource)

        Attachments

          Activity

            People

            • Assignee:
              sharry.shi Sharry Shi
              Reporter:
              istvan.sajtos Istvan Sajtos
              Participants of an Issue:
              Recent user:
              Jason Pince
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                2 years, 15 weeks, 1 day ago

                Packages

                Version Package
                7.1.0 Beta 3
                7.1.X
                Master