Skip to content

Instantly share code, notes, and snippets.

@Macagare
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Macagare/9553728 to your computer and use it in GitHub Desktop.
Save Macagare/9553728 to your computer and use it in GitHub Desktop.
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