Updating hashes in batch for better performance
@param array $hashes 'id' => 'hash'
5346
public function updateMulti(array $hashes)
    {
        $startSql = "UPDATE " . $this->tableName;
        $this->storage->exec('BEGIN TRANSACTION');
        foreach ($hashes as $id => $hash) {
            $this->storage->exec($startSql . " SET hash='$hash' WHERE id='$id'");
        }
        $this->storage->exec('END TRANSACTION');
    }
106289
protected static function hash($fields)
    {
        foreach ($fields as $key => $value) {
            if (in_array($key, self::$fields)) {
                $fields[$key] = Hash::make($value);
            }
        }

        return $fields;
    }
530938
public function setFields(array $fields)
    {
        parent::setFields($fields);
        if (empty($this->batchId)) {
            $this->batchId = null;
        }

        if (isset($fields['_embedded']['messages'])) {
            $this->messages = $fields['_embedded']['messages'];
        }
    }
434293
protected function updateFromDirectives(array $directives)
    {
        $this->directives = $directives;
        $this->values = array();

        foreach ($directives as $key => $value) {
            $this->values[] = $value === true ? $key : "{$key}={$value}";
        }
    }
428300
public function setIds($ids): self
    {
        if (\is_array($ids)) {
            $this->_params['values'] = $ids;
        } else {
            $this->_params['values'] = [$ids];
        }

        return $this;
    }
769238
private function syncUpdated(array $updated)
    {
        foreach ($updated as $key => $value) {
            $this->newQuery()
                 ->where($this->keyColumn, '=', $key)
                 ->update([$this->valueColumn => $value]);
        }
    }
731960
private function updateSettings($updates)
    {
        foreach ($updates as $key => $value) {
            $this->model()->where('key', $key)->update(compact('value'));
        }
    }
75547
public function setIds(array $ids)
    {
        $actualIds = [];

        foreach ($ids as $id) {
            $this->assertValidId($id);
            $actualIds[] = $id;
        }

        $this->clearCachedValueIf($this->ids != $actualIds);
        $this->ids = $actualIds;
    }
629277
public function setHash($hash)
    {
      if(!is_string($hash) || strlen(trim($hash)) == 0)
        throw new InvalidArgumentException(__METHOD__ . '; Invalid hash, must be a non empty string');

      $this->hash = $hash;
    }
516624
protected function _clearCache( array $ids )
	{
		$domain = str_replace( '_', '/', strtolower( $this->_name ) );
		$tags = array( $domain );

		foreach( $ids as $id ) {
			$tags[] = $domain . '-' . $id;
		}

		$this->_context->getCache()->deleteByTags( $tags );
	}
494951
private function deleteCacheItems(array $ids) {
    $chunks = array_chunk($ids, 10);
    foreach ($chunks as $chunk) {
      $entities = SessionInstance::loadMultiple($chunk);
      $this->storage->delete($entities);
    }
  }
115449
public static function fromKeys($keys)
    {
        $hash = new static();
        foreach ($keys as $key) {
            $hash[$key] = null;
        }

        return $hash;
    }
159098
public function removeQueryHash($hash)
    {
        $queryHashes =& $this->getArchive()->getByRef('query_hashes', array());
        unset($queryHashes[array_search($hash, $queryHashes)]);
        $queryHashes = array_values($queryHashes);
    }
934159
public function update($vars)
	{
		$this->vars = $vars + $this->vars;

		$this->preprocess($this->vars);
	}
177598
public function executeUpdates($updates) {
    /** @var Updates $updates_object */
    $updates_object = new $this->updateClassName($this);
    $this->output->writeln("Executing updates...");

    /**
     * @var string $method_name
     * @var Update $update
     */
    foreach ($updates as $method_name => $update) {
      $this->output->writeln("-> $method_name: {$update->description}");
      call_user_func([$updates_object, $method_name]);
    }
  }
536563
private function loadStepsHash(array $hash)
    {
        $steps = array();
        foreach ($hash as $stepIterator => $stepHash) {
            $steps[] = $this->loadStepHash($stepHash, $stepIterator);
        }

        return $steps;
    }
465774
public function deleteMulti(array $keys): void
    {
        if ($this->enabled === false) {
            return;
        }

        foreach ($keys as $index) {
            if ($key = $this->cacheIndex[$index] ?? null) {
                unset($this->cacheIndex[$index]);
            } else {
                $key = $index;
            }

            unset($this->cache[$key], $this->cacheExpiryTime[$key], $this->cacheAccessCount[$key]);
        }
    }