The cache is based on the query name, as well as the actual query going to
the SQL server.  If the search string is different, then the query would be
different, so it would get cached independently of the others.

Note that if you are using cfqueryparam in the query, it cannot be cached
with cachedwithin.

-Justin

 

> -----Original Message-----
> From: George Abraham [mailto:[EMAIL PROTECTED] 
> Sent: Monday, January 23, 2006 12:13 PM
> To: CF-Talk
> Subject: Re: storing query results while paging through
> 
> Justin,
> Suppose the query is named 'getResults' and I have enabled 
> the cachedwithin
> attribute. Say user1 comes along and searches for 'Portugal'. 
> The query
> 'getResults' is cached. Then user2 comes along and searches 
> for 'Spain'.
> This happens while user1 is paging through the resultset for 
> 'Portugal'.
> Then user3 comes along (while the sessions for user1 and 
> user2 are still on)
> and searches for 'Argentina'. What happens to the cache for 
> 'getResults'
> while all this is happening? How does CFMX 7 (which I am on) 
> handle all
> these interactions for cached queries?
> 
> Thanks,
> George
> 
> On 1/23/06, Justin D. Scott <[EMAIL PROTECTED]> wrote:
> >
> > Assuming your query pulls all of the results and you use 
> the startrow and
> > maxrows attributes when outputting, you could just use the 
> cachedwithin
> > attribute of cfquery itself to store the results in memory 
> without all the
> > fuss of session variables.  This will also have the benefit 
> of using the
> > same cache if multiple sessions search for the same thing 
> while it's in
> > the
> > cache.
> >
> > -Justin
> >
> >
> >
> > > -----Original Message-----
> > > From: George Abraham [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, January 23, 2006 10:34 AM
> > > To: CF-Talk
> > > Subject: storing query results while paging through
> > >
> > > All,
> > > I don't use session variables at all, but this might a good
> > > time to use
> > > them.
> > >
> > > I have a search page that takes in a search term, runs a
> > > query and then
> > > displays the results. The user is allowed to click into a
> > > result and then
> > > page through the search resultset while in a result (via 
> Previous/Next
> > > controls). Since I don't store the query results anywhere, I
> > > basically run
> > > that query every single time that the user presses Previous
> > > or Next (just so
> > > that I can find out where the user is while s/he is paging
> > > through and what
> > > the previous and next results are.) For an intensive search
> > > (which this is
> > > turning out to be), this means every time that the user does
> > > anything with
> > > the resultset, I am running a 4 or 5 second operation. Highly
> > > inefficient, I
> > > suspect.
> > >
> > > How do I cache the query results? Is a session variable the
> > > best option? I
> > > guess cookies would not be bad, but they are limited in the
> > > amount they can
> > > hold. How do people tackle this problem anyway?
> > >
> > > Thanks,
> > > George
> > >
> > >
> > >
> >
> > 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230235
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to