> http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/appfra29.htm
>
> it will cache it for everyone, its a server side cache
> ----- Original Message -----
> From: daniel kessler
> To: CF-Talk
> Sent: Wednesday, August 04, 2004 3:59 PM
> Subject: Re: tip of the day
>
>
> So by caching the query, it assures that everyone gets the same random
> TIP for the day or just that particular machine?
>
> > well there are a couple of ways to get a random record...
> > as long as ou are not using access there is a RAND() function to do
> it...
> >
> > something like this if i remember correctly
> >
> > select * from table order by Rand() limit 1
> >
> > that SHOULD return 1 random record everytime its ran.
> >
> > you could also get all of the IDs from the table and then select a
> > radom ID from the #ValueList(QueryName.QueryColumn)# variable
> >
> > like...
> > <cfquery name="IDs" datasource="datasource">
> > select ID from table
> > </cfquery>
> >
> > <cfset randomID = listGetAt(valuelist(IDs.ID), RandRange(1,
> > listlen(Valuelist(IDs.ID)))>
> >
> > then just select * from table where ID = #val(randomid)#
> >
> >
> > the caching part is easy, it is an attribute of the cfquery tag and
> as
> > long as its not cleared or the server rebooted, or CF services
> > restarted, then it should last the full cached duration...
> >
> > for 24 hours...
> >
> > <cfquery name="QueryName" datasource="datasourcename"
> > cachedwithin="#createtimespan(0,24,0,0)#">
> > select whatever
> > </cfquery>
> >
> >
> > ** CreateTimeSpan(Days,Hours,Minutes,Seconds)
> >
> >
> >
>
> > ----- Original Message -----
>
> > From: daniel kessler
>
> > To: CF-Talk
>
> > Sent: Tuesday, August 03, 2004 1:36 PM
>
> > Subject: Re: tip of the day
> >
> >
>
> > > Id stick with ID and tip, pull a random one each time and cache
> the
> >
>
> > > query for 24 hours.
> >
>
> > That brings up some questions. So, I pull a random tip each day,
> not
> > a random tip each page refresh. So what pulls the random tip and
> sets
> > it as the TOTD? I've also not yet looked into caching queries.
> ugh
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

