Example #1
0
 /**
  * Results are speculatively pre-fetched in blocks to improve performance. This can cause issues
  * if you're inserting rows and expect a previously create SearchResult to "see" those new rows. 
  * SearchResult::clearResultCacheForRow() will clear the result cache for a single row, specified by its primary key,
  * causing get() to re-fetch fresh data for the row. If applicable, the table storing related labels will also be purged. 
  *
  * @param string $ps_table Name of table to purge cache for
  * @pram int $pn_row_id The primary key of the row to purge cache for
  * @return void
  */
 public static function clearResultCacheForRow($ps_table, $pn_row_id)
 {
     unset(self::$s_prefetch_cache[$ps_table][$pn_row_id]);
     unset(self::$s_rel_prefetch_cache[$ps_table][$pn_row_id]);
     $ps_label_table = LabelableBaseModelWithAttributes::getLabelTable($ps_table);
     if ($ps_label_table) {
         unset(self::$s_prefetch_cache[$ps_label_table][$pn_row_id]);
         unset(self::$s_rel_prefetch_cache[$ps_label_table][$pn_row_id]);
     }
 }