In Railo 4 you can cache your functions and methods in a CFC, so that after the first request the results and output are not run anymore but obtained from cache

Take the following code in CacheDemo.cfc:

component {
function getTime(String name, Numeric age) cachedwithin="#createTimeSpan(0, 0, 0, 10)#" {
return Now() & " " & arguments.name & " " & arguments.age;
}
}

You can see that we have added the argument cachedwithin to the getTime function, when we call this multiple times, we will get the same result, as now the output and result of the method are cached!:

<cfset comp = new cfcs.CacheDemo()>
<cfdump var="#comp.getTime()#" label="Inital call">
<cfset sleep(1500)>
<cfdump var="#comp.getTime()#" label="Cached call">
<!--- now with attributes --->
<cfdump var="#comp.getTime("Elvis", "29")#" label="Inital call">
<cfdump var="#comp.getTime("Sean", "42")#" label="Inital call">
<cfset sleep(1500)>
<cfdump var="#comp.getTime("Elvis", "29")#" label="Cached call">
<cfdump var="#comp.getTime("Sean", "42")#" label="Cached call">