Skip to content

Instantly share code, notes, and snippets.

@aliaspooryorik
Created June 3, 2015 09:48
Show Gist options
  • Save aliaspooryorik/c78e2fee26080fd4db0b to your computer and use it in GitHub Desktop.
Save aliaspooryorik/c78e2fee26080fd4db0b to your computer and use it in GitHub Desktop.
testing Lucee's function caching
<cfscript>
function foo(a=1,b=2) cachedwithin="#createTimeSpan(0, 0, 0, 10)#" {
writeoutput(getTickCount() & " " & hash(serializeJSON(arguments)) & "<br>");
sleep(10);
}
foo(1, 2);
foo(a=1, b=2);
foo(b=2, a=1);
foo(b=2);
foo(a=1);
foo();
// see if it's cached with same args
foo(1, 2);
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment