clear_cache() public static method

Clear the query cache
public static clear_cache ( $table_name = null, $connection_name = self::DEFAULT_CONNECTION )
コード例 #1
0
 public static function clear_cache()
 {
     return \ORM::clear_cache();
 }
コード例 #2
0
ファイル: base_tests.php プロジェクト: dev-lucid/lucid
 protected function controller_save_new_and_delete($class)
 {
     if (is_null($class::$table) === true) {
         return;
     }
     if (count($class::$insert_values) === 0) {
         print "\n" . 'WARNING: Cannot perform ' . $class . '->' . __FUNCTION__ . '(). In order to use this test, you must set ' . $class . '::$insert_values to an array of names/values to insert into your table in ' . __FILE__ . ".\n";
         return;
     }
     # first, make sure it's not already in there
     $model = lucid::model($class::$table);
     foreach ($class::$insert_values as $column => $value) {
         $model->where($column, $value);
     }
     $model = $model->find_one();
     $this->assertTrue($model === false);
     # perform the insert using the controller->save() method
     $controller = lucid::controller($class::$table);
     call_user_func_array([$controller, 'save'], array_merge([0], array_values($class::$insert_values), [false]));
     # check to make sure it is now in the table
     $model = lucid::model($class::$table);
     foreach ($class::$insert_values as $column => $value) {
         $model->where($column, $value);
     }
     $model = $model->find_one();
     $this->assertFalse($model === false);
     # delete the new row, and recheck
     $model->delete();
     # idiorm does not clear cache on deletes :(
     ORM::clear_cache();
     # make sure the inserted value is no longer in the table
     $model = lucid::model($class::$table);
     foreach ($class::$insert_values as $column => $value) {
         $model->where($column, $value);
     }
     $model = $model->find_one();
     $this->assertTrue($model === false);
 }