Skip to content

Instantly share code, notes, and snippets.

@Macagare

Macagare/file.cfm

Last active Aug 29, 2015
Embed
What would you like to do?
Floor current dateTime to influence the Last-Modified header. Header widgets will only be loaded from server every 15 minutes. Reduces server load when the requested content needs to be generated.
<cfscript>
function foor15Min(t) {
var roundedMinutes = INT(minute(t) / 15 ) * 15;
return CreateDateTime(year(t), month(t), day(t), hour(t),roundedMinutes,0)
}
</cfscript>
<CFHEADER NAME="Cache-Control" VALUE="public, max-age=900">
<CFHEADER NAME="Last-Modified" VALUE="#LSDateFormat(#foor15Min( DateConvert( 'Local2UTC', now() ) )#, 'ddd, dd mmm yyyy')# #LSTimeFormat(#foor15Min( DateConvert( 'Local2UTC', now() ) )#, 'HH:mm:ss')# GMT">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.