From 8c6502de2f8ec2bd8382cd6945c327d7be400e14 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 28 Jan 2026 05:34:41 +0000
Subject: [PATCH] =Queue cleanup - seems to be working enough to get legacy before and after going!
---
inc/blocks/FormBlock.php | 26 +++++++++++---------------
1 files changed, 11 insertions(+), 15 deletions(-)
diff --git a/inc/blocks/FormBlock.php b/inc/blocks/FormBlock.php
index 512a9c9..3e8a892 100644
--- a/inc/blocks/FormBlock.php
+++ b/inc/blocks/FormBlock.php
@@ -1,7 +1,7 @@
<?php
namespace JVBase\blocks;
-use JVBase\managers\CacheManager;
+use JVBase\managers\Cache;
use JVBase\meta\MetaManager;
use JVBase\managers\CloudflareTurnstile;
use Exception;
@@ -19,8 +19,8 @@
*/
class FormBlock
{
- protected static FormBlock|null $instance = null;
- protected CacheManager $cache;
+ protected static ?FormBlock $instance = null;
+ protected Cache $cache;
protected array $forms;
protected string $form_contact;
@@ -36,7 +36,7 @@
public function __construct()
{
- $this->cache = CacheManager::for('form_blocks', WEEK_IN_SECONDS);
+ $this->cache = Cache::for('forms', WEEK_IN_SECONDS);
// Initialize forms from filter
$this->forms = $this->registerForms();
$this->form_contact = apply_filters('jvb_form_contact', '');
@@ -131,16 +131,12 @@
}
$cache_key = $this->cache->generateKey($block);
- $cached = $this->cache->get($cache_key);
- $cached = false;
- if ($cached) {
- return $cached;
- }
-
- $rendered = $this->renderForm($form_type, $block);
-
- $this->cache->set($cache_key, $rendered);
- return $rendered;
+ return $this->cache->remember(
+ $cache_key,
+ function() use ($form_type, $block) {
+ return $this->renderForm($form_type, $block);
+ }
+ );
}
/**
@@ -283,7 +279,7 @@
}
}
- echo '<form id="' . esc_attr($form_id) . '" data-form-id="'.esc_attr($type).'" data-save="form" data-noautosave>';
+ echo '<form id="' . esc_attr($form_id) . '" data-form-id="'.esc_attr($type).'" data-save="form">';
// wp_nonce_field('jvb_form_' . $type);
}
--
Gitblit v1.10.0