In C#, I created static methods to help me perform simple operations. For example:
public static class StringHelper
{
public static string Reverse(string inp
One way to create statics in ColdFuison is to put the function or variable in the metadata of the object. Its not perfect but like a static you don't have to create an instance of the object to call them and they'll last until the server is restarted so they are quite fast after the first call.
Here's a quick snippet:
component name="Employee"
{
public Employee function Init(){
var metadata = getComponentMetaData("Employee");
if(!structKeyExists(metadata,"myStaticVar")){
lock name="metadata.myStaticVar" timeout="10"{
metadata.myStaticVar = "Hello Static Variable.";
}
}
return this;
}
}
More detail here: http://blog.bittersweetryan.com/2011/02/using-metadata-to-add-static-variables.html.