WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #16336


Ignore:
Timestamp:
01/21/11 22:52:28 (4 years ago)
Author:
scribu
Comment:

The caching is done on top of WPDB, not through it.

Also, what about DML queries? (INSERT, DELETE etc.)

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #16336

    • Property Keywords close added
    • Property Component changed from General to Database
  • Ticket #16336 – Description

    initial v1  
    11wpdb::get_row never uses the cached results, look at this 
    22 
     3{{{ 
    34        function get_row( $query = null, $output = OBJECT, $y = 0 ) { 
    45                $this->func_call = "\$db->get_row(\"$query\",$output,$y)"; 
     
    89                        return null; 
    910                // more code 
     11}}} 
    1012 
    1113and then 
    1214 
     15{{{ 
    1316        function query( $query ) { 
    1417                if ( ! $this->ready ) 
     
    2124                $return_val = 0; 
    2225                $this->flush(); 
    23  
     26}}} 
    2427 
    2528See how the cache never gets called? if you write a query, the old one gets flushed without checking if it was the same as before, if you use null, null gets returned, an if($this->last_query != $query) needs to be put in ::query or the return null removed from ::get_row, I'd prefer the first solution.