ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:userguide:learn_caching:adodb_coding

Using Cached Queries

ADOdb provides replacement functions that look for cached results, instead of querying the database directly. The names of the methods match the normal method names but with the word 'cache' prepended, e.g.

  • cacheGetOne replaces getOne
  • cacheExecute replaces execute

The format of the parameters in the cache methods matches that of the normal methods, except for the fact that the parameters are shifted one entry and the first parameter is always the TTL (Time-To-Live) of the query.

/*
* look for a cached query with a life of 2400 seconds
*/
$sql = 'SELECT code,description FROM xref_table';
$db->cacheGetAssoc(2400,$sql);

The response from the cache functions is exactly the same as the normal functions.

v5/userguide/learn_caching/adodb_coding.txt · Last modified: 2016/03/29 04:56 by mnewnham