Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. on fourq.getData() calls
    • check typename.objectpool for UUID
      • if present
        • return struct
      • if not,
        • make dbgateway call
        • check if room in objectpool
        • purge/update aobjects FIFO list as required
        • update objectpool with object struct
        • return struct
      • update cache stats
  2. return object struct to content type call exactly as per original

Essentially update dbgateway calls for CRUD methods in fourq.cfc with calls to object broker. dbgateway would then be responsible for making calls on the Object broker. Update delete and setdata calls to purge objectpool as required.

...

Code Block
title/fourq/fourq.cfc
	<cffunction name="getData" access="public" output="false" returntype="struct" hint="Get data for a specific objectid and return as a structure, including array properties and typename.">
		<cfargument name="objectid" type="uuid" required="true">
		<cfargument name="dsn" type="string" required="false" default="#application.dsn#">
		<cfargument name="dbowner" type="string" required="false" default="#ucase(application.dbowner)#">
		<cfargument name="bShallow" type="boolean" required="false" default="false" hint="Setting to true filters all longchar property types from record.">
		<cfargument name="bFullArrayProps" type="boolean" required="false" default="false" hint="Setting to true returns array properties as an array of structs instead of an array of strings.">
		<cfargument name="bUseInstanceCache" type="boolean" required="false" default="true" hint="setting to use instance cache if one exists">
		
		<cfset var stobj=structnew()>
		<cfset var tablename=getTablename()>
		<cfset var aprops="">
		<cfset var sqlSelect="">
		<cfset var i=0>
		<cfset var qgetData="">
		<cfset var key="">
		<cfset var qArrayData="">
		<cfset var aTmp=arraynew(1)>
		<cfset var stArrayProp=structnew()>
		<cfset var col=0>
		<cfset var j=0>
		
		<cfparam name="instance.stobj.typename" default="#tablename#">

		<cfif isdefined("instance.bgetdata") AND instance.bgetdata EQ arguments.objectid AND arguments.bUseInstanceCache>
			<!--- get local instance cache --->
			<cfset stObj = instance.stobj>
			<cftrace type="information" category="coapi" var="stobj.typename" text="getData() used instance cache.">
			
		<!--- todo: prototype object manager --->
		<cfelseif structkeyexists(application.objectbroker, instance.stobj.typename) AND structkeyexists(application.objectbroker[FCDEV30:instance.stobj.typename], arguments.objectid)>
			<cfset stObj = application.objectbroker[FCDEV30:instance.stobj.typename][FCDEV30:arguments.objectid]>
			<cfset instance.bgetData = arguments.objectid>
			<cftrace type="information" category="coapi" var="stobj.typename" text="getData() used objectpool cache.">
			
		<cfelse>
			<!--- build a local instance cache --->
			<cfinclude template="_fourq/getData.cfm">
			<cfset instance.stobj = stobj>
			<cfset instance.bgetData = arguments.objectid>
			<cftrace type="information" category="coapi" var="stobj.typename" text="getData() used database.">
			
			<!--- todo: prototype object manager (populate pool) --->
			<cfif structkeyexists(application.objectbroker, instance.stobj.typename)>
				<cfset application.objectbroker[FCDEV30:instance.stobj.typename][FCDEV30:stobj.objectid]=duplicate(stobj)>
			</cfif>
		</cfif>
		
		<cfreturn stObj>
	</cffunction>

...