Pete / Calvin,

What I really wanted to know is is storing this large query in an application scope and searching the structure using a function such as StructFind to perform a search a 100 times or so in a loop a generally accepted practice? Am I on the right lines using this code (it currently doesn't work!):

<cflock timeout="30" throwontimeout="no"
  type="exclusive" scope="application">
  <cfparam name="application.ThisForecastResults" default="">
  <cfif NOT IsQuery(application.ThisForecastResults)>
   <cfquery name="application.ThisForecastResults" datasource="#request.app.dsn#">
    SELECT *
FROM SAF.DAILY_ROTA
       WHERE ROTA_REF = <cfqueryparam value="#url.rid#" CFSQLType="CF_SQL_NUMERIC">
</cfquery>
  </cfif>
</cflock>

<cfloop index = "i" from = "1" to = "100">
<cflock timeout="30" throwontimeout="no"
  type="exclusive" scope="application">
   <cfoutput>#StructFind(application.ThisForecastResults, "#i#")#</cfoutput>
</cflock>
</cfloop>

-----Original Message-----
From: Calvin Ward [mailto:[EMAIL PROTECTED]
Sent: 19 December 2003 10:11 am
To: CF-Talk
Subject: Re: Storing big queries in Application Scope to search?

How would you make the cached query solution viable on a load balanced solution with non-sticky sessions?

- Calvin
  ----- Original Message -----
  From: Pete Freitag
  To: CF-Talk
  Sent: Thursday, December 18, 2003 5:27 PM
  Subject: Re: Storing big queries in Application Scope to search?

  [EMAIL PROTECTED] wrote:

  > Hi all,
  >
  > Anyone know why this won't work? Its got me stumped! Also, any
  > comments on whether it's good practice to use the application scope to
  > store a large set of query results would be useful (i.e. to refer to
  > that set of results in a loop instead of hammering the database 100's
  > of times...). Use query of queries instead? Hope someone can see what
  > I'm getting at!

  Hi Rob,

  why not just use a cached query? it is essentially doing the same thing,
  but is easier to code/read, and allows you to set a different timeout
  for each query.

  ___________________________________
  Pete Freitag
  http://www.cfdev.com/
  Author of the CFMX Developers Cookbook
  http://www.petefreitag.com/bookshelf/
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to