From ccf5e61a075c35d24befc175994b5cb8957ca322 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 26 Aug 2026 21:45:53 +0000
Subject: [PATCH] =Extra JVB() calls replaced, minor tweaks
---
inc/blocks/SummaryBlock.php | 19 +++----------------
1 files changed, 3 insertions(+), 16 deletions(-)
diff --git a/inc/blocks/SummaryBlock.php b/inc/blocks/SummaryBlock.php
index 186ebbd..9ea9fd8 100644
--- a/inc/blocks/SummaryBlock.php
+++ b/inc/blocks/SummaryBlock.php
@@ -28,9 +28,7 @@
$this->cache = Cache::for('summary_block', 'post', WEEK_IN_SECONDS);
add_action('init', [ $this, 'registerBlock' ]);
add_action('wp_enqueue_scripts', [$this, 'enqueueScripts']);
- if (JVB_TESTING) {
- $this->cache->flush();
- }
+
}
public function registerBlock()
@@ -50,21 +48,10 @@
return (is_tax()) ? 'tax' : 'content';
}
- protected function generateKey():string
- {
- $obj = get_queried_object();
- return match (true) {
- is_tax() => jvbNoBase($obj->taxonomy) . $obj->term_id,
- is_a($obj, 'WP_Post_type') => jvbNoBase($obj->name),
- is_a($obj, 'WP_User') => jvbUserRole($obj->ID),
- default => jvbNoBase($obj->post_type) . $obj->ID,
- };
- }
-
public function render(array $attributes, string $content, WP_Block $block)
{
$this->config = $this->getConfig();
- $key = $this->generateKey();
+
if (is_tax()) {
$this->cache = Cache::for('summary_tax', 'term', WEEK_IN_SECONDS);
} elseif (is_author()) {
@@ -138,7 +125,7 @@
ob_start();
$this->renderBlock();
$content = ob_get_clean();
- $this->cache->set($key, $content);
+ $this->cache->set(get_queried_object_id(), $content);
return $content;
}
--
Gitblit v1.10.0