Double nice :O) -----Original Message----- From: Paul Johnston [mailto:[EMAIL PROTECTED] Sent: 13 March 2003 15:34 To: [EMAIL PROTECTED] Subject: RE: [ cf-dev ] RE: [notspam] RE: [ cf-dev ] FIFO queue
> You're going to have to explain that one I'm affraid :O) I'll help... > Actually this is pretty neat, > > <cfif (ArrayLen(application.cache.Q) GTE application.cache.capacity) > > <cfset r = ArrayDeleteAt(application.cache.Q, 1) /> > </cfif> ArrayLen is obviously the number of items in the array The test for the cfif, is whether the "application.cache.Q" (the storage array) has reached it's largest capacity (set as application.cache.capacity). If it has, then delete the first item. ArrayDeleteAt does the same as push (or pop can't remember which) and moves every element in the array down one index so: myArray = "a", "b", "c" ArrayDeleteAt(myarray, 1) Gives: myArray = "b", "c" (not "", "b", "c") > <cfset r = ArrayAppend(application.cache.Q.object) > All this line does is say that you should append the object (whatever it is) to the end of the array. Performance wise it's good, although my previous answer may be slightly more long-winded, it may just be easier to implement. Paul -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED] -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED]
