<!-- 
RSS generated by JIRA (9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b) at Sun Feb 11 23:51:40 CET 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Magnolia - Issue tracker</title>
    <link>https://jira.magnolia-cms.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-uk</language>    <build-info>
        <version>9.4.2</version>
        <build-number>940002</build-number>
        <build-date>19-01-2023</build-date>
    </build-info>


<item>
            <title>[MGNLCACHE-45] Option to set lifetime on allowed cache mappings</title>
                <link>https://jira.magnolia-cms.com/browse/MGNLCACHE-45</link>
                <project id="10670" key="MGNLCACHE">Cache Modules</project>
                    <description>&lt;p&gt;Add a new &quot;lifetime&quot; node to the allowed cache URI mappings.  This node specifies an amount of time that a page matching this URI can be retrieved from the cache.  This adds some flexibility to pages where you have some dynamic content but for performance reasons want to show a snapshot of that dynamic content and have it refreshed periodically.&lt;/p&gt;

&lt;p&gt;I currently have patches against 2.1.3 and will look into updating them for 2.2 but the implementation is pretty simple:&lt;/p&gt;

&lt;p&gt;1) Update info.magnolia.cms.beans.config.Cache.cacheCacheableURIMappings() to retrieve the &quot;lifetime&quot; node and store its value along with the &quot;allowed&quot; value in the cachedCacheableURIMapping map, e.g.,&lt;/p&gt;

&lt;p&gt;NodeData lifetime = container.getNodeData(CACHE_LIFETIME_NODE);&lt;br/&gt;
long l = lifetime.getLong();&lt;/p&gt;

&lt;p&gt;// values&lt;span class=&quot;error&quot;&gt;&amp;#91;0&amp;#93;&lt;/span&gt; := allowed&lt;br/&gt;
// values&lt;span class=&quot;error&quot;&gt;&amp;#91;1&amp;#93;&lt;/span&gt; := lifetime, &amp;lt;= 0 is eternity&lt;br/&gt;
cachedCacheableURIMapping.put(p, new Object[] &lt;/p&gt;
{ BooleanUtils.toBooleanObject(allow), new Long(l) }
&lt;p&gt;);&lt;/p&gt;

&lt;p&gt;2) Add new getLifetime(HttpServletRequest request) method to info.magnolia.cms.beans.config.Cache.  It looks just like isCacheable(HttpServletRequest request) except it retrieves the lifetime value from the map.&lt;/p&gt;

&lt;p&gt;3) Update info.magnolia.cms.beans.config.Cache.isCacheable() to retrieve the &quot;allowed&quot; value from the cachedCacheableURIMapping map.  This assumes an implementation like in (1) above where I&apos;m storing both the value of &quot;allowed&quot; and the lifetime in the value of the map.&lt;/p&gt;

&lt;p&gt;4) Add new isExpired(HttpServletRequest request) method to info.magnolia.cms.beans.runtime.Cache.  This checks that the sum of the cached item&apos;s creation time and lifetime is less than the current time, e.g.,&lt;/p&gt;

&lt;p&gt;public static boolean isExpired(HttpServletRequest request) {&lt;br/&gt;
    long ctime = Cache.getCreationTime(request);&lt;br/&gt;
    long lifetime = info.magnolia.cms.beans.config.Cache.getLifetime(request);&lt;br/&gt;
    return lifetime &amp;lt;= 0 ? false : new java.util.Date().getTime() &amp;gt; (ctime + lifetime);&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;5) Update info.magnolia.cms.core.CacheHandler.cacheURI() to check if an item that is currently cached is expired.  If this is the case, the item must be removed from the cache and the cache handler should continue, e.g.,&lt;/p&gt;

&lt;p&gt;if (Cache.isCached(request) || CacheHandler.hasRedirect(request)) {&lt;br/&gt;
    if (Cache.isExpired(request)) &lt;/p&gt;
{
        CacheHandler.flushResource(request);
    }
&lt;p&gt; else {&lt;br/&gt;
        return;&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;6) Add new flushResource(HttpServletRequest request) method to info.magnolia.cms.core.CacheHandler that removes the requested page from the cache, e.g.,&lt;/p&gt;

&lt;p&gt;public static void flushResource(HttpServletRequest request) {&lt;br/&gt;
    flushResource(CACHE_DIRECTORY + DEFAULT_STORE + Path.getURI(request));&lt;br/&gt;
    flushResource(CACHE_DIRECTORY + COMPRESSED_STORE + Path.getURI(request));&lt;br/&gt;
}&lt;/p&gt;

&lt;p&gt;7) Modify info.magnolia.cms.servlets.EntryServlet to check if a cached item is expired, e.g.,&lt;/p&gt;

&lt;p&gt;// try to stream from cache first&lt;br/&gt;
if (cacheable &amp;amp;&amp;amp; Cache.isCached(req) &amp;amp;&amp;amp; !Cache.isExpired(req)) {&lt;br/&gt;
    if (CacheHandler.streamFromCache(req, res)) &lt;/p&gt;
{
        return; // if success return
    }
&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;That&apos;s about it, there is still some weirness if you restart Tomcat w/o clearing out the cache but otherwise it&apos;s working fine.  It would be more kind to the users to specify the lifetime in seconds or minutes rather than milliseconds.&lt;/p&gt;
</description>
                <environment></environment>
        <key id="11280">MGNLCACHE-45</key>
            <summary>Option to set lifetime on allowed cache mappings</summary>
                <type id="2" iconUrl="https://jira.magnolia-cms.com/secure/viewavatar?size=xsmall&amp;avatarId=10891&amp;avatarType=issuetype">New Feature</type>
                                            <priority id="4" iconUrl="https://jira.magnolia-cms.com/images/icons/priorities/minor.svg">Minor</priority>
                        <status id="6" iconUrl="https://jira.magnolia-cms.com/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="8">Outdated</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="tduffey">Thomas Duffey</reporter>
                        <labels>
                    </labels>
                <created>Mon, 14 Nov 2005 18:01:29 +0100</created>
                <updated>Fri, 14 Mar 2014 15:17:02 +0100</updated>
                            <resolved>Fri, 14 Mar 2014 15:17:02 +0100</resolved>
                                                                    <component>configuration</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>1</watches>
                                    <workratio workratioPercent="0"/>
                                    <progress percentage="0">
                                    <originalProgress>
                                                    <row percentage="100" backgroundColor="#89afd7"/>
                                            </originalProgress>
                                                    <currentProgress>
                                                    <row percentage="0" backgroundColor="#51a825"/>
                                                    <row percentage="100" backgroundColor="#ec8e00"/>
                                            </currentProgress>
                            </progress>
                                    <aggregateprogress percentage="0">
                                    <originalProgress>
                                                    <row percentage="100" backgroundColor="#89afd7"/>
                                            </originalProgress>
                                                    <currentProgress>
                                                    <row percentage="0" backgroundColor="#51a825"/>
                                                    <row percentage="100" backgroundColor="#ec8e00"/>
                                            </currentProgress>
                            </aggregateprogress>
                                    <timeoriginalestimate seconds="86400">3d</timeoriginalestimate>
                            <timeestimate seconds="86400">3d</timeestimate>
                                        <comments>
                            <comment id="11555" author="pbracher" created="Mon, 21 Nov 2005 12:09:47 +0100"  >&lt;p&gt;Sounds great. Can you create a patch?&lt;/p&gt;</comment>
                            <comment id="11991" author="pbracher" created="Wed, 17 May 2006 15:15:42 +0200"  >&lt;p&gt;cache is now plugable&lt;/p&gt;</comment>
                            <comment id="81264" author="gjoseph" created="Fri, 14 Mar 2014 15:17:02 +0100"  >&lt;p&gt;This request dates from pre-3.0 times. With 3.0, the cache module became pluggable; with 3.6, and perhaps already before, one could configure ehcache settings to control the lifetime of cached pages. Of course if I&apos;m missing something, please reopen this issue and we&apos;ll look at it again.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                            <customfield id="customfield_14166" key="com.okapya.jira.checklist:checklist">
                        <customfieldname>Acceptance criteria</customfieldname>
                        <customfieldvalues>
                            
        <checklist>
        <![CDATA[
                            




                
                                    <div class="o-completion" style="display: flex; flex-shrink: 0;"><span  class="aui-lozenge aui-lozenge-complete" style="font-size: 12px; font-weight: normal; display: flex; flex-direction: row; align-items: center;" ><span style="padding-right: 4px; vertical-align: middle;"><svg width="15" height="15" viewBox="0 0 15 15" xmlns="http://www.w3.org/2000/svg" fill="white"><path clip-rule="evenodd" d="m10.41037,3.42544l-7.86501,0c-0.72395,0 -1.31084,0.58688 -1.31084,1.31084l0,7.86508c0,0.7239 0.58689,1.3108 1.31084,1.3108l7.86501,0c0.724,0 1.3109,-0.5869 1.3109,-1.3108l0,-7.86508c0,-0.72396 -0.5869,-1.31084 -1.3109,-1.31084zm-7.86501,-0.65542c-1.08593,0 -1.96626,0.88032 -1.96626,1.96626l0,7.86508c0,1.0859 0.88033,1.9662 1.96626,1.9662l7.86501,0c1.086,0 1.9663,-0.8803 1.9663,-1.9662l0,-7.86508c0,-1.08594 -0.8803,-1.96626 -1.9663,-1.96626l-7.86501,0z" fill-rule="evenodd"/><path d="m5.09049,10.18526l-1.82767,-1.82766l-0.78479,0.78479l2.61246,2.61246l5.38758,-5.38754l-0.78483,-0.78479l-4.60275,4.60274z"/></svg></span><span>Empty</span></span></div>
                        ]]>
    </checklist>


                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10111" key="com.atlassian.jira.toolkit:reporterdomain">
                        <customfieldname>Company</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>crescendocollective.com</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10031" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of First Response</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Mon, 21 Nov 2005 12:09:47 +0100</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_12730" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_14151" key="com.atlassian.jira.toolkit:message">
                        <customfieldname>Docu info</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10061" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comm is not jira-dev</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10071" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last participant</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>mmuehlebach</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_13136" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            9 years, 49 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10020" key="com.atlassian.jira.toolkit:attachments">
                        <customfieldname>Number of attachments</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10150" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname>Number of comments</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>3.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>gjoseph</customfieldvalue>
            <customfieldvalue>pbracher</customfieldvalue>
            <customfieldvalue>tduffey</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_10833" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i01cbz:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10244" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>7880</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14145" key="com.intenso.jira.issue-templates:issue-templates-customfield">
                        <customfieldname>Template</customfieldname>
                        <customfieldvalues>
                            


                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_15131" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Time in Discovery</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10032" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time in Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>