Skip to content

Commit

Permalink
🐛 default 60 sec for cache did not work (v2)
Browse files Browse the repository at this point in the history
Signed-off-by: bnomei <[email protected]>
  • Loading branch information
bnomei committed Aug 9, 2024
1 parent 1209aca commit b3e7e52
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 9 deletions.
3 changes: 2 additions & 1 deletion classes/Blueprints/Blueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public function toArray(): array

// some might not be cacheable like when they are class based and have dynamic fields
// only set here now if they will not be written on __destruct by trait
if ($this->cache && ! method_exists($this->modelClass, 'blueprintCacheKey')) {
// the cacha could be null which means it will use the default value
if (! in_array($this->cache, [false, 0]) && ! method_exists($this->modelClass, 'blueprintCacheKey')) {
BlueprintCache::set($key, $blueprint);
}

Expand Down
2 changes: 2 additions & 0 deletions classes/Blueprints/BlueprintCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ public static function cacheDir(): ?string
$file = self::cacheDirMemoryFile();
if (F::exists($file)) {
$dir = F::read($file);

return $dir !== false ? $dir : null;
}

return null;
}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "bnomei/kirby-blueprints",
"type": "kirby-plugin",
"version": "4.4.7",
"version": "4.4.8",
"license": "MIT",
"homepage": "https://github.com/bnomei/kirby3-blueprints",
"description": "PHP Class-based Blueprints for Kirby CMS for better type safety and code completion",
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

const KIRBY_HELPER_DUMP = false;
require_once __DIR__.'/../vendor/autoload.php';
echo (new Kirby())->render();
echo (new Kirby)->render();
2 changes: 1 addition & 1 deletion tests/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

$micotime = microtime(true);
//\Bnomei\Blueprints\BlueprintCache::preloadFromLoadMap();
$kirby = new Kirby();
$kirby = new Kirby;
$render = $kirby->render();
$micotime = microtime(true) - $micotime;
header('X-Render-Time: '.number_format($micotime, 3, '.', '').'s');
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/installed.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php return array(
'root' => array(
'name' => 'bnomei/kirby-blueprints',
'pretty_version' => '4.4.7',
'version' => '4.4.7.0',
'pretty_version' => '4.4.8',
'version' => '4.4.8.0',
'reference' => null,
'type' => 'kirby-plugin',
'install_path' => __DIR__ . '/../../',
Expand All @@ -11,8 +11,8 @@
),
'versions' => array(
'bnomei/kirby-blueprints' => array(
'pretty_version' => '4.4.7',
'version' => '4.4.7.0',
'pretty_version' => '4.4.8',
'version' => '4.4.8.0',
'reference' => null,
'type' => 'kirby-plugin',
'install_path' => __DIR__ . '/../../',
Expand Down

0 comments on commit b3e7e52

Please sign in to comment.