====== cacheGetAssoc ======
~~NOTOC~~
== syntax ==
mixed cacheGetAssoc (
mixed $cacheSeconds
optional string $sql=falsse
optional string[] $bindvars=false
optional bool $forceArray=false
optional bool $first2Cols=false
)
===== Description =====
Cache functions search for the results of an executed query in the query cache. The results of a query have an expiration time specified by the first parameter. If an unexpired cache result is not found, the query is cached for the specified period.
For an explanation of the syntax of the other parameter of ''cacheGetAssoc()'', see [[v5:reference:connection:getassoc|getAssoc()]].
---------------------------------
===== Usage =====
/*
* DB2 Connection assumed
*/
$ar = $db->cacheGetAssoc(600,"SELECT ACTNO,ACTDESC FROM ACT");
/*
* $ar returns:
Array
(
[10] => MANAGE/ADVISE
[20] => ESTIMATE COST
[30] => DEFINE SPECS
[40] => LEAD PROGRAM/DESIGN
......
)
*/
{{tag>[cache]}}