Flush the current session, handling common errors.
776276
def flushing(self):
        
        try:
            yield
            self.session.flush()
        except (FlushError, IntegrityError) as error:
            error_message = str(error)
            # There ought to be a cleaner way to capture this condition
            if "duplicate" in error_message:
                raise DuplicateModelError(error)
            if "already exists" in error_message:
                raise DuplicateModelError(error)
            if "conflicts with" in error_message and "identity key" in error_message:
                raise DuplicateModelError(error)
            elif "still referenced" in error_message:
                raise ReferencedModelError(error)
            elif "is not present" in error_message:
                raise MissingDependencyError(error)
            else:
                raise ModelIntegrityError(error)
1287274
public void flush() {
        if (annotationsBlocked()) return;
        if (isFlushing()) return;

        startFlushing();
        try {
            while (q.nonEmpty()) {
                q.next().run();
            }
            while (typesQ.nonEmpty()) {
                typesQ.next().run();
            }
            while (afterTypesQ.nonEmpty()) {
                afterTypesQ.next().run();
            }
            while (validateQ.nonEmpty()) {
                validateQ.next().run();
            }
        } finally {
            doneFlushing();
        }
    }
503502
public function flush()
    {
        $keys = $this->redis->keys($this->redis->prefix('*'));

        foreach ($keys as $key) {
            $this->redis->del($key);
        }
    }
405907
def handle_flush_error(cls, exception):
        """"""

        trace = exception.args[0]
        m = re.match(cls.MYSQL_FLUSH_ERROR_REGEX, trace)

        if not m:
            raise exception

        entity = m.group('entity')
        eid = m.group('eid')

        raise AlreadyExistsError(entity=entity, eid=eid)
432866
void flushAll() {
		for (Buffer buff : bufferPool) {
			try {
				buff.getExternalLock().lock();
				buff.flush();
			} finally {
				buff.getExternalLock().unlock();
			}
		}
	}
399339
def flush(self):
        
        self.acquire()
        try:
            if self.outStream and hasattr(self.outStream, "flush"):
                self.outStream.flush()
            if self.errStream and hasattr(self.errStream, "flush"):
                self.errStream.flush()
        finally:
            self.release()
687007
def FlushCache(self):
    """"""
    self._cache = b''
    self._cache_start_offset = None
    self._cache_end_offset = None
    self._ResetDecompressorState()
640443
def flush_all(self, conn):
        """"""
        command = b'flush_all\r\n'
        response = yield from self._execute_simple_command(
            conn, command)

        if const.OK != response:
            raise ClientException('Memcached flush_all failed', response)
1155368
public function flush()
    {
        IlluminateCache::forget($this->key(Constants::BUILD_CACHE_KEY));

        IlluminateCache::forget($this->key(Constants::VERSION_CACHE_KEY));
    }
33585
public static function flushEvents(): void
    {
        $client = Hub::getCurrent()->getClient();

        if ($client instanceof Client) {
            $transportProperty = new \ReflectionProperty(Client::class, 'transport');
            $transportProperty->setAccessible(true);

            $transport = $transportProperty->getValue($client);

            if ($transport instanceof HttpTransport) {
                $closure = \Closure::bind(function () {
                    $this->cleanupPendingRequests();
                }, $transport, $transport);

                $closure();
            }
        }
    }
264544
def _flush(self, buffer):
        
        with _handle_oss_error():
            self._bucket.put_object(key=self._key, data=buffer.tobytes())
1142414
public function resetSession()
    {
        /*
         * TODO not in love with suppressing errors
         */
        if (session_status() !== PHP_SESSION_ACTIVE) {
            @session_start();
        }
        @session_destroy();
        @session_unset();
        @session_start();
        session_regenerate_id(true);
        $_SESSION[__CLASS__] =& $this;
        session_write_close();
    }
411968
public function flush()
  {
    // God, PHP really has some esoteric ways of doing simple things.
    $host = $this->host_.($this->port_ != 80 ? ':'.$this->port_ : '');

    $headers = array();
    $defaultHeaders = array('Host' => $host,
                            'Accept' => 'application/x-thrift',
                            'User-Agent' => 'PHP/THttpClient',
                            'Content-Type' => 'application/x-thrift',
                            'Content-Length' => TStringFuncFactory::create()->strlen($this->buf_));
    foreach (array_merge($defaultHeaders, $this->headers_) as $key => $value) {
        $headers[] = "$key: $value";
    }

    $options = array('method' => 'POST',
                     'header' => implode("\r\n", $headers),
                     'max_redirects' => 1,
                     'content' => $this->buf_);
    if ($this->timeout_ > 0) {
      $options['timeout'] = $this->timeout_;
    }
    $this->buf_ = '';

    $contextid = stream_context_create(array('http' => $options));
    $this->handle_ = @fopen($this->scheme_.'://'.$host.$this->uri_, 'r', false, $contextid);

    // Connect failed?
    if ($this->handle_ === FALSE) {
      $this->handle_ = null;
      $error = 'THttpClient: Could not connect to '.$host.$this->uri_;
      throw new TTransportException($error, TTransportException::NOT_OPEN);
    }
  }
802142
def flush(self):
        
        self.logger.debug('Flush joining')
        self.queue.join()
        self.logger.debug('Flush joining ready')
303926
public static function wrapped_session_flush(&$session_object)
    {
        global $TSUGI_SESSION_OBJECT;
        if ( $session_object === null && isset($TSUGI_SESSION_OBJECT) ) $session_object = $TSUGI_SESSION_OBJECT;
        if ( is_object($session_object) ) {
            $session_object->flush();
            return;
        }
        if ( is_array($session_object) ) {
            foreach($session_object as $k => $v ) {
                unset($session_object[$k]);
            }
            for ($i = 0; $i < count($session_object); $i++) {
                unset($session_object[$i]);
            }
        }
        session_unset();
    }
57574
def _flush(self, buffer):
        
        container, obj = self._client_args
        with _handle_client_exception():
            self._client.put_object(container, obj, buffer)
526263
public function flushAllAction() {
        Mage::dispatchEvent('turpentine_varnish_flush_all');
        $result = Mage::getModel('turpentine/varnish_admin')->flushAll();
        foreach ($result as $name => $value) {
            if ($value === true) {
                $this->_getSession()
                    ->addSuccess(Mage::helper('turpentine/data')
                        ->__('Flushed Varnish cache for: ').$name);
            } else {
                $this->_getSession()
                    ->addError(Mage::helper('turpentine/data')
                        ->__('Error flushing Varnish cache on: ').$name);
            }
        }
        $this->_redirect('*/cache');
    }