cachingcoldfusioncoldfusion-2016qoq

ColdFusion | Query timeout error questions


Here is my code

<cfquery name="employeeData" datasource="xyz" cachedwithin="#CreateTimeSpan(0,0,60,0)#">
    SELECT employee, salary
    FROM employee
</cfquery>

<cfquery name="wellPaidEmployee" dbtype="query">
    SELECT employee, salary
    FROM employeeData WHERE salary > <cfqueryparam cfsqltype="cf_sql_integer" value="10000">
</cfquery>

Condition:
The first query EmployeeData gets timed out due to some issue and throws an error "query timed out"

Question:

  1. On the next call, Will the query EmployeeData run or it will have query timed out error in the cache as we cached it using cachewithin?
  2. What will happen with the wellPaidEmployee on first run and next run?

Solution

  • Only successful db requests are cached so the EmployeeData query will run on next pass.

    The wellPaidEmployee query will run if employeeData does not error.