What I'm faced with is coming up with an application scoped array or structure that houses the primary key values of a table and when that record was cached. The powers that be decided this would be a good approach. The table houses the cached html for our content management system. The table's primary key is composed of 4 fields. When the query is called to retrieve the cached html, the 'cached after' query attribute would look up the cached date from the application scoped array or structure. I would pass the primary key values to a UDF or CFC that would then inspect the application scoped array or structure to ascertain the last cached date. That is the idea anyway.
Am I loosing anyone yet? I know CF can handle only a 3 dimension array, so I'm not sure how that would work with my table containing 4 dimensions. Do you see a performance penalty with arrays because CF uses 'undefined array elements' to fill in blank spots. For instance if my array is myArray[132] = '5/15/2003' (where 132 represents the value of one of my primary keys) then the length of my array is 132 even though I'm storing 1 value, the array is carrying 131 empty spaces. Does this make sense? My idea is to concatenate the primary key values into a string and use that as the key in a structure. Does this seem a better solution? Keep in mind my cached html table has 10s of thousands of cached records that would have its primary key stored in this application scoped array or structure. Would a structure containing the concatenated primary key as the structure's key be an efficient approach? Thanks - Tom Schreck 817-252-4900 [EMAIL PROTECTED] I have not failed. I've found 10,000 ways that won't work. - Thomas Edison -----Original Message----- From: Dan Blackman [mailto:[EMAIL PROTECTED] Sent: Thursday, August 28, 2003 9:56 AM To: [EMAIL PROTECTED] Subject: RE: structures vs arrays It's also negligible unless you are working with hundereds of thousands of rows in MHO. You are not going to see the difference until you are hitting a sizable recordset... My 2 c -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of S.Isaac Dealey Sent: Thursday, August 28, 2003 9:41 AM To: [EMAIL PROTECTED] Subject: Re: structures vs arrays > Which one is more efficient at retrieving data: structure > or an array? Depends what you're doing with it... A structure is faster at finding a key than it is to find a given string within an array... i.e. idx = structkeyexists(mystruct,"blah") vs. something like this: idx = listfind(arraytolist(myarray),"blah") or worse idx = 0; for (x = 1; x lte arraylen(myarray); x = x + 1) { if (myarray[x] is "blah") { idx = x; break; } } I believe arrays are slightly faster when looping over them, i.e. <cfloop index="x" from="1" to="#arraylen(myarray)#"></cfloop> vs. <cfloop item="x" collection="#mystruct#"></cfloop> and I'm pretty sure getting a single value from an array myarray[3] is faster than getting a single value from a structure mystruct["blue"] I hope that's helpful. :) s. isaac dealey 972-490-6624 team macromedia volunteer http://www.macromedia.com/go/team chief architect, tapestry cms http://products.turnkey.to onTap is open source http://www.turnkey.to/ontap ----------------------------------------------- To post, send email to [EMAIL PROTECTED] To unsubscribe: Send UNSUBSCRIBE to [EMAIL PROTECTED] To subscribe / unsubscribe: http://www.dfwcfug.org ----------------------------------------------- To post, send email to [EMAIL PROTECTED] To unsubscribe: Send UNSUBSCRIBE to [EMAIL PROTECTED] To subscribe / unsubscribe: http://www.dfwcfug.org ----------------------------------------------- To post, send email to [EMAIL PROTECTED] To unsubscribe: Send UNSUBSCRIBE to [EMAIL PROTECTED] To subscribe / unsubscribe: http://www.dfwcfug.org
