enable query caching?

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default enable query caching?

    I want to cache a QoQ.

    I added cachedwithin="#CreateTimeSpan(0, 0, 5, 0)#" to the CFquery tag. This
    should cache for 5 minutes .. which should be good enough for my test. I
    test for the cache with
    <cfoutput>#IsDefined("qoqRequirementDateDueX.Cache d")#</cfoutput>.
    This value is NO. So I reread the CF 7 Reference Manual. It says that query
    caching must be enabled in the Administrator. I cannot find any help on
    that. Your guidance is appreciated.

    -brian


    Brian Hogue Guest

  2. Similar Questions and Discussions

    1. web svc caching
      We are about to deploy our newly developed web svc, but since our svr is a laptop with limited resource and limited bandwidth, I guess I'll use a...
    2. query caching
      hi if i do <cfcache action="cache"> and have a query on this page, is it cached? or do i need to do <cfquery cachedwithin> ? thanks k
    3. FM caching
      Hi All, On Windows, does anyone know how to manipulate where FM caches? Our Windows network is setup to only allow a 30mg roaming profile...
    4. ASP Caching
      Hello, I have a simple web form page in which I insert/update data to a database. The SQL code to insert data is written in a server side submit...
  3. #2

    Default Re: enable query caching?

    If a query is cached, it is cached - to my knowledge you can't test for it

    What you will see is a performance difference when you have a ton of data.
    i.e. on our 50,000 item DB, the first query takes abput 20-30 seconds. If we
    have it cached for a period of time, subsequent page loads by ANYONE will see
    that list in 2-3 seconds. If we remove the cache setting, it will take 20-30
    sec for each page request

    It returns NO because you actually haven't setup a variable by that name so it
    does not exist.

    As fo the ADMIN, yes you have to tell it to allow cached queries by setting
    the maximum number of cached queries under the caching section.

    SafariTECH Guest

  4. #3

    Default Re: enable query caching?

    SafariTECH -

    Thanks for the reply. On your second point, the documentation suggests that
    caching a query automatically sets up this variable and makes it value YES.
    On the last point, then the default value (100) enables query caching.

    Let's try this a different way. Can I cache a QoQ? If yes, is there special
    syntax? Or can I use the developer's guide as a model? The guide only
    demonstrates CFquery against a DB, not QoQ.

    -brian

    "SafariTECH" <contact@safaritech.com> wrote in message
    news:df5n5f$t3t$1@forums.macromedia.com...
    > If a query is cached, it is cached - to my knowledge you can't test for it
    >
    > What you will see is a performance difference when you have a ton of
    data.
    > i.e. on our 50,000 item DB, the first query takes abput 20-30 seconds. If
    we
    > have it cached for a period of time, subsequent page loads by ANYONE will
    see
    > that list in 2-3 seconds. If we remove the cache setting, it will take
    20-30
    > sec for each page request
    >
    > It returns NO because you actually haven't setup a variable by that name
    so it
    > does not exist.
    >
    > As fo the ADMIN, yes you have to tell it to allow cached queries by
    setting
    > the maximum number of cached queries under the caching section.
    >

    Brian Hogue Guest

  5. #4

    Default Re: enable query caching?

    Brian Hogue,

    I've only skimmed your post but:

    1) To test whether the query is cached, use the "result" attribute of cfquery
    and then output #yourResultName.cached#.

    <cfquery result="yourResultName" ....> .... </cfquery>

    <cfoutput><b>is cached?: </b>#yourResultName.cached#</cfoutput>


    2) Administrator setting: Maximum number of cached queries:

    I would think that specifying a number greater than zero would enable query
    caching. Or in other words, cached queries are not allowed if the maximum
    number is zero

    3) I don't know that it's a great idea in every situation, but yes you can
    cache a QoQ.

    <cfquery name="getEmps" datasource="#myDSN#" result="myResult">
    SELECT FirstName, LastName, City
    FROM employees
    ORDER BY LastName, FirstName
    </cfquery>

    <!-- cache QofQ --->
    <cfquery name="getLocalEmployees" dbtype="query"
    cachedWithin="#CreateTimeSpan(0,0,5,0)#" result="myResult">
    SELECT FirstName, LastName, City
    FROM getEmps
    WHERE City = 'Seattle'
    ORDER BY LastName, FirstName
    </cfquery>

    <cfoutput><b>cached: </b>#myResult.cached#<br></cfoutput>

    mxstu Guest

  6. #5

    Default Re: enable query caching?

    ** EDIT: NG users do not see modifications **

    Brian Hogue,

    I see I should have read your post more thoroughly ;-) Afaik, "result"
    produces one time variables that are only available *after* you run the
    cfquery, which doesn't sound like what you are looking for. As SafariTech
    mentioned, I don't think that there is a way to test for the existence of a
    cached query.





    mxstu Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139