Flushes Dirty objects in {@link PersistenceCache} to databases.
512193
private void flush()
    {
        // Get flush stack from Flush Manager
        Deque<Node> fs = flushManager.getFlushStack();

        // Flush each node in flush stack from top to bottom unit it's empty

        if (log.isDebugEnabled())
        {
            log.debug("Flushing following flush stack to database(s) (showing stack objects from top to bottom):\n"
                    + fs);
        }
        if (fs != null)
        {
            boolean isBatch = false;
            while (!fs.isEmpty())
            {
                Node node = fs.pop();

                // Only nodes in Managed and Removed state are flushed, rest
                // are ignored
                if (node.isInState(ManagedState.class) || node.isInState(RemovedState.class))
                {
                    EntityMetadata metadata = getMetadata(node.getDataClass());
                    node.setClient(getClient(metadata));

                    // if batch size is defined.
                    if ((node.getClient() instanceof Batcher) && ((Batcher) (node.getClient())).getBatchSize() > 0)
                    {
                        isBatch = true;
                        ((Batcher) (node.getClient())).addBatch(node);
                    }
                    else if (isTransactionInProgress
                            && MetadataUtils
                                    .defaultTransactionSupported(metadata.getPersistenceUnit(), kunderaMetadata))
                    {
                        onSynchronization(node, metadata);
                    }
                    else
                    {
                        node.flush();
                    }
                }

            }

            if (!isBatch)
            {
                // TODO : This needs to be look for different
                // permutation/combination
                // Flush Join Table data into database
                flushJoinTableData();
                // performed,
            }
        }
    }
1044000
def flush(self):
        """"""
        if self.flag[0] != 'r':
            with self.write_mutex:
                if hasattr(self.db, 'sync'):
                    self.db.sync()
                else:
                    # fall-back, close and re-open, needed for ndbm
                    flag = self.flag
                    if flag[0] == 'n':
                        flag = 'c' + flag[1:]  # don't clobber an existing database
                    self.db.close()
                    # noinspection PyArgumentList
                    self.db = self.open(self.path, flag, self.mode, **self.open_kwargs)
224260
public function flushCache()
    {
        $ids = $this->getMemberIDList();
        foreach ($this->getServices() as $service) {
            $service->flushMemberCache($ids);
        }
    }
121887
public void flush() {
    try {
      ArrayList<Batch> batches = this.incomplete.all();
      int numOutstandingRecords = 0;
      for (Batch batch: batches) {
        numOutstandingRecords += batch.getRecords().size();
      }
      LOG.debug ("Flush called on {} batches with {} records total", batches.size(), numOutstandingRecords);
      for (Batch batch: batches) {
        batch.await();
      }
    } catch (Exception e) {
      LOG.error ("Error happened while flushing batches");
    }
  }
627375
private void flush() {

        if (pendingAbsoluteValueBug != null) {
            absoluteValueAccumulator.accumulateBug(pendingAbsoluteValueBug, pendingAbsoluteValueBugSourceLine);
            pendingAbsoluteValueBug = null;
            pendingAbsoluteValueBugSourceLine = null;
        }
        accumulator.reportAccumulatedBugs();
        if (sawLoadOfMinValue) {
            absoluteValueAccumulator.clearBugs();
        } else {
            absoluteValueAccumulator.reportAccumulatedBugs();
        }
        if (gcInvocationBugReport != null && !sawCurrentTimeMillis) {
            // Make sure the GC invocation is not in an exception handler
            // for OutOfMemoryError.
            boolean outOfMemoryHandler = false;
            for (CodeException handler : exceptionTable) {
                if (gcInvocationPC < handler.getHandlerPC() || gcInvocationPC > handler.getHandlerPC() + OOM_CATCH_LEN) {
                    continue;
                }
                int catchTypeIndex = handler.getCatchType();
                if (catchTypeIndex > 0) {
                    ConstantPool cp = getThisClass().getConstantPool();
                    Constant constant = cp.getConstant(catchTypeIndex);
                    if (constant instanceof ConstantClass) {
                        String exClassName = (String) ((ConstantClass) constant).getConstantValue(cp);
                        if ("java/lang/OutOfMemoryError".equals(exClassName)) {
                            outOfMemoryHandler = true;
                            break;
                        }
                    }
                }
            }

            if (!outOfMemoryHandler) {
                bugReporter.reportBug(gcInvocationBugReport);
            }
        }

        sawCurrentTimeMillis = false;
        gcInvocationBugReport = null;

        exceptionTable = null;
    }
209344
@SuppressWarnings("Duplicates")
    @Override
    public void flushVertexCache(SqlgGraph sqlgGraph, Map<SchemaTable, Pair<SortedSet<String>, Map<SqlgVertex, Map<String, Object>>>> vertexCache) {
        Connection con = sqlgGraph.tx().getConnection();
        for (SchemaTable schemaTable : vertexCache.keySet()) {
            Pair<SortedSet<String>, Map<SqlgVertex, Map<String, Object>>> vertices = vertexCache.get(schemaTable);
            VertexLabel vertexLabel = null;
            if (!schemaTable.isTemporary()) {
                vertexLabel = sqlgGraph.getTopology().getVertexLabel(schemaTable.getSchema(), schemaTable.getTable()).orElseThrow(
                        () -> new IllegalStateException(String.format("VertexLabel %s not found.", schemaTable.toString())));
            }

            //We pre-create the sequence ids and pass them through in the copy command.
            List<Long> ids = new LinkedList<>();
            if (vertexLabel != null && vertexLabel.hasIDPrimaryKey()) {
                // get all ids from sequence first
                String sql = "SELECT NEXTVAL('" + maybeWrapInQoutes(schemaTable.getSchema()) + "." + maybeWrapInQoutes(VERTEX_PREFIX + schemaTable.getTable() + "_ID_seq") + "') from generate_series(1," + vertices.getRight().values().size() + ") ;";
                if (logger.isDebugEnabled()) {
                    logger.debug(sql);
                }
                try (PreparedStatement preparedStatement = con.prepareStatement(sql)) {
                    ResultSet resultSet = preparedStatement.executeQuery();
                    while (resultSet.next()) {
                        ids.add(resultSet.getLong(1));
                    }
                    resultSet.close();
                } catch (SQLException e) {
                    throw new RuntimeException(e);
                }
            }
            Iterator<Long> it = ids.iterator();

            String sql = internalConstructCompleteCopyCommandSqlVertex(
                    sqlgGraph,
                    schemaTable.isTemporary(),
                    schemaTable.getSchema(),
                    schemaTable.getTable(),
                    vertexLabel != null && vertexLabel.hasIDPrimaryKey(),
                    vertices.getLeft());
            int numberInserted = 0;
            try (Writer writer = streamSql(sqlgGraph, sql)) {
                for (Map.Entry<SqlgVertex, Map<String, Object>> sqlgVertexKeyValueMapEntry : vertices.getRight().entrySet()) {
                    SqlgVertex sqlgVertex = sqlgVertexKeyValueMapEntry.getKey();
                    Map<String, Object> keyValueMap = sqlgVertexKeyValueMapEntry.getValue();
                    //The map must contain all the keys, so make a copy with it all.
                    LinkedHashMap<String, Object> values = new LinkedHashMap<>();
                    if (vertexLabel != null && vertexLabel.hasIDPrimaryKey()) {
                        long id = it.next();
                        sqlgVertex.setInternalPrimaryKey(RecordId.from(schemaTable, id));
                        values.put("ID", id);
                    }
                    for (String key : vertices.getLeft()) {
                        values.put(key, keyValueMap.get(key));
                    }
                    if (schemaTable.isTemporary()) {
                        writeTemporaryStreamingVertex(writer, values);
                    } else {
                        writeStreamingVertex(writer, values, vertexLabel);
                    }
                    numberInserted++;
                    if (vertexLabel != null && !vertexLabel.hasIDPrimaryKey()) {
                        List<Comparable> identifiers = new ArrayList<>();
                        for (String identifier : vertexLabel.getIdentifiers()) {
                            identifiers.add((Comparable) values.get(identifier));
                        }
                        sqlgVertex.setInternalPrimaryKey(RecordId.from(SchemaTable.of(schemaTable.getSchema(), schemaTable.getTable()), identifiers));
                    }
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
633812
public function flushCache()
    {
        $finder = new Finder();

        foreach ($finder->files()->in($this->cacheDir)->name('*.php') as $file) {
            unlink($file->getRealpath());
        }

        return true;
    }
444346
public function flush()
    {
        $this->_result = null;
        $this->_lastResult = array();
        $this->_lastQuery = null;
        $this->_lastQueryHash = null;
    }
1029049
public synchronized void flush()
                    throws ObjectManagerException
    {
        final String methodName = "flush";
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        methodName);

        if (storeStrategy == STRATEGY_SAVE_ONLY_ON_SHUTDOWN) {
            // Since we only flush on shutdown make sure we are shutting down, otherwise just return. 
            if (objectManagerState.getObjectManagerStateState() != ObjectManagerState.stateStopped) {
                if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                    trace.exit(this,
                               cclass,
                               methodName);
                return;
            }

            // If there are any active transactions it is not safe to flush.
            if (objectManagerState.getTransactionIterator().hasNext()) {
                trace.warning(this,
                              cclass,
                              methodName,
                              "ObjectStore_UnsafeToFlush",
                              this
                                );
                if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                    trace.exit(this,
                               cclass,
                               methodName);
                return;
            }
        } // if ( storeStrategy == STRATEGY_SAVE_ONLY_ON_SHUTDOWN ).

        // Debug freespace list
        // if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, "START of Flush: newFreeSpace.size()      = "+newFreeSpace.size());
        // if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, "START of Flush: freeSpaceByLength.size() = "+freeSpaceByLength.size());

        // We are single threaded through flush, we are now about to make
        // updates to the directory and free space map, which must be consistent.
        // Also reserve space in the file for the directory updates and free space map.
        updateDirectory();

        // Release any space into the free space pool.
        if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
            trace.debug(this,
                        cclass,
                        methodName,
                        "Release new free space");

        // Free up space that was release by directory changes, replaced or deleted Objects.
        freeAllocatedSpace(newFreeSpace);

        if (gatherStatistics) {
            long now = System.currentTimeMillis();
            releasingEntrySpaceMilliseconds += now - lastFlushMilliseconds;
            lastFlushMilliseconds = now;
        } // if (gatherStatistics).

        // Write the modified parts of the directory to disk.
        directory.write();

        if (gatherStatistics) {
            long now = System.currentTimeMillis();
            directoryWriteMilliseconds += now - lastFlushMilliseconds;
            lastFlushMilliseconds = now;
        } // if (gatherStatistics).

        // Write the free space map to disk.
        writeFreeSpace();

        // Force the data to disk then force the header, if we can make the assumption that
        // these writes go to disk first, this first force is unnecessary.
        if (storeStrategy == STRATEGY_KEEP_ALWAYS)
            force();

        writeHeader();
        if (storeStrategy == STRATEGY_KEEP_ALWAYS)
            force();

        // Debug freespace list
        // if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, "END of Flush: newFreeSpace.size()      = "+newFreeSpace.size());
        // if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled()) trace.debug(this, cclass, methodName, "END of Flush: freeSpaceByLength.size() = "+freeSpaceByLength.size());

        // Defect 573905
        // Reset the newFreeSpace after we have finished with it to release the
        // memory it uses while we are not flushing.
        newFreeSpace.clear();

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       methodName);
    }
910375
def flush(self, batch_size=1000):
        
        keys = self.database.keys(self.namespace + ':*')
        for i in range(0, len(keys), batch_size):
            self.database.delete(*keys[i:i + batch_size])
145750
public void flushLog()
                    throws ObjectManagerException
    {
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this
                        , cclass
                        , "flushLog"
                            );

        ((FileLogOutput) objectManagerState.logOutput).flush();

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass
                       , "flushLog"
                            );
    }
1187402
private void flush(FlinkKafkaProducer.KafkaTransactionState transaction) throws FlinkKafkaException {
		if (transaction.producer != null) {
			transaction.producer.flush();
		}
		long pendingRecordsCount = pendingRecords.get();
		if (pendingRecordsCount != 0) {
			throw new IllegalStateException("Pending record count must be zero at this point: " + pendingRecordsCount);
		}

		// if the flushed requests has errors, we should propagate it also and fail the checkpoint
		checkErroneous();
	}
1070889
public function flush()
    {
        if (false === (bool)$this->configuration->get('clearCacheForAllDomains')) {
            $this->flushByTag('sfc_domain_' . \str_replace('.', '_', GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY')));

            return;
        }

        $this->logger->debug('SFC Flush');

        if ($this->isBoostMode()) {
            $identifiers = GeneralUtility::makeInstance(CacheRepository::class)->findAllIdentifiers();
            $this->getQueue()->addIdentifiers($identifiers);

            return;
        }

        $absoluteCacheDir = GeneralUtility::getFileAbsFileName(self::CACHE_DIRECTORY);
        $removeService = GeneralUtility::makeInstance(RemoveService::class);
        $removeService->softRemoveDir($absoluteCacheDir . 'https/');
        $removeService->softRemoveDir($absoluteCacheDir . 'http/');
        parent::flush();
        $removeService->removeDirs();
    }
713315
public static function flushAll()
    {
        $GLOBALS["CACHE_MANAGER"]->cleanAll();
        $GLOBALS["stackCacheManager"]->cleanAll();
        $staticHtmlCache = StaticHtmlCache::getInstance();
        $staticHtmlCache->deleteAll();
        BXClearCache(true);
    }
1113360
def flush(self, table):
        '''
        
        '''
        table_path = os.path.join(self.db_path, table)
        if os.path.exists(table_path):
            os.unlink(table_path)
1333599
protected void flushObject (DObject obj)
    {
        // move this object into the dead pool so that we don't claim to have it around anymore;
        // once our unsubscribe message is processed, it'll be 86ed
        int ooid = obj.getOid();
        _ocache.remove(ooid);
        _dead.put(ooid, obj);

        // ship off an unsubscribe message to the server; we'll remove the object from our table
        // when we get the unsub ack
        _comm.postMessage(new UnsubscribeRequest(ooid));
    }
314736
void flushCache() throws Exception {
		if (!entryCache.isEmpty()) {
			entries.putAll(entryCache);
			entryCache.clear();
		}
		if (!eventsBufferCache.isEmpty()) {
			eventsBuffer.putAll(eventsBufferCache);
			eventsBufferCache.clear();
		}
	}