At 03:11 PM 5/3/2000 -0700, Doug Ford wrote:
>Sharon, 
>
>Just to answer your questions:
>
>1) I don't think it's showing up in the debugging code.

But you don't know?  Forgive me if I'm being too basic.  But if you have
debugging turned on, the query will show up at the bottom of the page.  The
query will also indicate "cached query".

>2) The query is not cached anywhere else on the site.  
>50% uses this code and it's all in one location.

OK.

>3) I am not pulling a random record only because after watching
>the random numbers being generated, it doesn't always produce
>the best results.  So I created a database with the name of the banner,
>a position number, and a begin date and end date.
>Let's say that I have 20 banners. They are given a position number
>of 100 through 120.
>My query reads the DB, grabs the record at position 100, and also finds
out the last record.
>I then add 1 to the last position number (120 - making the new number 121)
and resave the
>record.
>It does it pretty quickly.. sometimes there are a few glitches because of
multiple reads at 
>the same time but this way I can guarantee that all the banners will be
evenly distributed.

Ah, I see.  But I'm willing to bet that I could come up with a decent
APPLICATION structure to do the same thing. <grin>

>Looking at your code, do you take any kind of performance hit when a lot
of people
>hit your site at one time and the information is held by the CFLOCK?

No performance hit.  The lock is just for the splitsecond necessary to copy
the array from local scope into application scope.  And you'll notice that
the code only runs when the array isn't already defined.

Sorry I couldn't be of more help!

Sharon

>Thanks,
>
>Doug
>
>
>
>-----Original Message-----
>From:  Sharon DiOrio [SMTP:[EMAIL PROTECTED]]
>Sent:  Wednesday, May 03, 2000 2:13 PM
>To:    [EMAIL PROTECTED]
>Cc:    [EMAIL PROTECTED]
>Subject:       RE: Forcing a query refresh
>
>A couple of questions.
>
>1.  Is the query showing up in the debugging code?
>2.  Is the query cached anywhere else on the site?
>3.  Are you pulling a random record from the query, or does the query
>change everytime?
>
>Just an option, when we do randomized bannerads, we usually build an
>APPLICATION scope array.  The code looks something like this:
>
><!--- Initialize the array in the application.cfm --->
><cfif NOT IsDefined("APPLICATION.BannerArray")>
>       <cfquery name="getBanners" datasource="#APPLICATION.dsn#">
>               SELECT *
>               FROM Banners
>       </cfquery>
>       <cfset BannerArray = ArrayNew(1)>
>       <cfloop query="getBanners">
>               <cfset BannerArray[CurrentRow] = BannerPath>
>       </cfloop>
>       <cflock name="#APPLICATION.ApplicationName#" timeout="10">
>               <cfset APPLICATION.BannerArray= BannerArray>
>               <cfset APPLICATION.BannerNumber = getBanners.RecordCount>
>       </cflock>
></cfif>
>
><!---Display a random banner on any page --->
><cfoutput>
>       <img src="#APPLICATION.BannerArray[RandRange(1,APPLICATION.BannerNumber)]#">
></cfoutput>
>
>Sharon
>
>At 12:47 PM 5/3/2000 -0700, Doug Ford wrote:
>>Katrina,
>>
>>The reason I say it's not running the query again is because of the same 
>>information
>>that is being presented to me.
>>
>>I am using a query to grab and pull a web banner for my Home page.
>>What I do is grab the top most banner from the list of banners,
>>store the info in a variable, put that banner to the bottom of the list
>>and then display the variable as the banner.
>>
>>So if I hit refresh, a new banner should appear.  Since it doesn't
>>always work, I am trying to figure it out.
>>
>>Thanks.
>>
>>Doug
>>
>>
>>-----Original Message-----
>>From: [EMAIL PROTECTED] [SMTP:[EMAIL PROTECTED]]
>>Sent: Wednesday, May 03, 2000 9:42 AM

>>To:   [EMAIL PROTECTED]
>>Subject:      Re: Forcing a query refresh
>>
>>
>>How do you know that it's not running the query again?  What browser are
>>you using.  If you hold control while you click refresh that will force it
>>to make the call back to your server for the latest information.
>>
>>--Katrina
>>
>>====================
>>Katrina Chapman
>>Consultant
>>Ameriquest Mortgage
>>
>>
>> 
>>   
>>                    dford@midrangecom 
>>   
>>                    puting.com (Doug         To: 
>>    "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> 
>>                    Ford)                    cc: 
>>   
>>                                             Subject:     Forcing a query 
>>refresh
>>                    05/03/00 09:33 AM 
>>   
>>                    Please respond to 
>>   
>>                    cf-talk 
>>   
>> 
>>   
>> 
>>   
>>
>>
>>
>>Hi Folks,
>>
>>What's the best way of forcing a query to always
>>run instead of it being cached?
>>
>>I am pulling a record from a DB and displaying it,
>>but when I do a refresh/reload it doesn't
>>run the query again.
>>
>>What's the best way of doing that?
>>
>>Thanks,
>>
>>Doug
>>------------------------------------------------------------------------  
>>------
>>
>>Archives: http://www.eGroups.com/list/cf-talk
>>To Unsubscribe visit
>>http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
>>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>>the body.
>>
>>
>>
>>
>>------------------------------------------------------------------------  
>>------
>>Archives: http://www.eGroups.com/list/cf-talk
>>To Unsubscribe visit 
>>http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or 
>>send a message to [EMAIL PROTECTED] with 'unsubscribe' in 
>>the body.
>>
>>---------------------------------------------------------------------------
>---
>>Archives: http://www.eGroups.com/list/cf-talk
>>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>the body.
>> 
> 

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to