Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

Commit

Permalink
🐛 render cache now properly disabled by default
Browse files Browse the repository at this point in the history
Signed-off-by: Bruno Meilick <[email protected]>
  • Loading branch information
bnomei committed Nov 8, 2019
1 parent 853da79 commit 3bf14f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions classes/Handlebars.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ public function __construct(array $options = [])
'debug' => option('debug'),
'extension-output' => option('bnomei.handlebars.extension-output'),
'extension-input' => option('bnomei.handlebars.extension-input'),
'cache.render' => option('bnomei.handlebars.cache.render'),
'render' => option('bnomei.handlebars.render'),
];
$this->options = array_merge($defaults, $options);
$this->options['cache.render'] = $this->options['cache.render'] && !$this->options['debug'];
$this->options['render'] = $this->options['render'] && !$this->options['debug'];

foreach ($this->options as $key => $call) {
if (is_callable($call) && !in_array($call, ['hbs', 'handlebars'])) {
Expand Down Expand Up @@ -118,7 +118,7 @@ public function fieldsToValue(array $data): array
*/
public function read(string $template, array $data): ?string
{
if (!$this->option('cache.render')) {
if (!$this->option('render')) {
$this->renderCacheId = null;
return null;
}
Expand All @@ -143,7 +143,7 @@ public function renderCacheId()
*/
public function write(?string $renderCacheId = null, string $result): bool
{
if ($renderCacheId && $this->option('cache.render')) {
if ($renderCacheId && $this->option('render')) {
return kirby()->cache('bnomei.handlebars.render')->set($renderCacheId, $result);
}
return false;
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/kirby3-handlebars",
"type": "kirby-plugin",
"version": "3.0.6",
"version": "3.0.7",
"license": "MIT",
"description": "Kirby 3 Component for semantic templates with Handlebars and Mustache",
"authors": [
Expand Down

0 comments on commit 3bf14f1

Please sign in to comment.