Ask Ben: Accessing Cached CFCs With AJAX via Remote Proxies

<cfcomponent
	output="false"
	hint="I provide methods for managing messages.">
 
 
	<cffunction
		name="Init"
		access="public"
		returntype="any"
		output="false"
		hint="I return an intialized object.">
 
		<!--- Create instance variables. --->
		<cfset VARIABLES.Instance = {
			Messages = []
			} />
 
		<!--- Return this object. --->
		<cfreturn THIS />
	</cffunction>
 
 
	<cffunction
		name="AddMessage"
		access="public"
		returntype="any"
		output="false"
		hint="I add a message to the message collection.">
 
		<!--- Define arguments. --->
		<cfargument
			name="Message"
			type="string"
			required="true"
			hint="I am the message being added."
			/>
 
		<!--- Add the message to the collection. --->
		<cfset ArrayAppend(
			VARIABLES.Instance.Messages,
			ARGUMENTS.Message
			) />
 
		<!--- Return this object for method chaining. --->
		<cfreturn THIS />
	</cffunction>
 
 
	<cffunction
		name="ClearMessages"
		access="public"
		returntype="any"
		output="false"
		hint="I clear the message collection.">
 
		<!--- Reset the message collection variable. --->
		<cfset VARIABLES.Instance.Messages = [] />
 
		<!--- Return this object for method chaining. --->
		<cfreturn THIS />
	</cffunction>
 
 
	<cffunction
		name="GetMessages"
		access="public"
		returntype="array"
		output="false"
		hint="I return the message collection.">
 
		<cfreturn VARIABLES.Instance.Messages />
	</cffunction>
 
</cfcomponent>

For Cut-and-Paste