Search code examples
phpdatabasecachingadodb

How to use Query cache with ADODB?


How to use Query cache with ADOdb in PHP? Is it default in ADOdb or Is there any configuration needed ?


Solution

  • Set the cache directory, e.g.

    $GLOBALS['ADODB_CACHE_DIR']=$_SERVER['DOCUMENT_ROOT'].'/../cache/adodb';
    

    Now you can use the Cache* methods like CacheGetOne to get a cached result

    $data = $rs->CacheGetOne($seconds_to_cache, $sql);