Skip to content

Commit

Permalink
default cache path (#842)
Browse files Browse the repository at this point in the history
* Create additional folder in default cache path

* Static analyze fix
  • Loading branch information
norberttech authored Nov 26, 2023
1 parent 9ca0166 commit 7ddca63
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/core/etl/src/Flow/ETL/ConfigBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,21 @@ public function build() : Config
{
$this->id ??= \uniqid('flow_php', true);
$this->serializer ??= new CompressingSerializer();
$this->cache ??= new LocalFilesystemCache(
\is_string(\getenv(Config::CACHE_DIR_ENV)) && \realpath(\getenv(Config::CACHE_DIR_ENV))
? \getenv(Config::CACHE_DIR_ENV)
: \sys_get_temp_dir(),
$this->serializer
);
$cachePath = \is_string(\getenv(Config::CACHE_DIR_ENV)) && \realpath(\getenv(Config::CACHE_DIR_ENV))
? \getenv(Config::CACHE_DIR_ENV)
: \sys_get_temp_dir() . '/flow_php/';

if ($this->cache === null) {
if (!\file_exists($cachePath)) {
\mkdir($cachePath, 0777, true);
}

$this->cache = new LocalFilesystemCache(
$cachePath,
$this->serializer
);
}

$this->externalSort ??= new MemorySort(
$this->id,
$this->cache,
Expand Down

0 comments on commit 7ddca63

Please sign in to comment.