From 772462eeca3002a1d52508aeba485aab2b4742ad Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 03 Mar 2026 19:06:19 +0000
Subject: [PATCH] =MAJOR OVERHAUL. Likely should have made a new branch ages ago. Key changes: Registrar.php is the base for custom post types, taxonomies, and user roles. Replaces JVB_CONTENT, JVB_TAXONOMY, and JVB_USER constants, eliminates most of Features.php (except for JVB_SITE, JVB_MEMBERSHIP), and has built in sanitizing and validation via sub-classes. Also started a major overhaul of the Schema output. Created a shit ton of property traits and classes to help sanitize and ensure proper data for different schema types. Still a bunch to do, but better to be starting committing changes here on this other branch.
---
inc/managers/NewsRelationships.php | 15 +++++++--------
1 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/inc/managers/NewsRelationships.php b/inc/managers/NewsRelationships.php
index 1e9eb46..12098e9 100644
--- a/inc/managers/NewsRelationships.php
+++ b/inc/managers/NewsRelationships.php
@@ -16,13 +16,13 @@
class NewsRelationships
{
private string $table_name;
- private object $cache;
+ private Cache $cache;
public function __construct()
{
global $wpdb;
$this->table_name = $wpdb->prefix . BASE . 'news_relationships';
- $this->cache = new CacheManager('news_relationships', 3600); // 1 hour cache by default
+ $this->cache = Cache::for('news_relationships', WEEK_IN_SECONDS)->connect('post', true)->connect('taxonomy', true)->connect('user',true);
// Register hooks
add_action('init', [$this, 'registerHooks']);
@@ -512,7 +512,7 @@
}
// Update cache
- $this->cache->invalidate('shop_' . $shop_id);
+ $this->cache->forget($shop_id);
// Update shop total count
$this->updateShopTotal($shop_id);
@@ -534,7 +534,7 @@
);
// Update cache
- $this->cache->invalidate('shop_' . $shop_id);
+ $this->cache->forget($shop_id);
}
/**
@@ -566,8 +566,7 @@
*/
public function getShopNewsStats(int $shop_id):array
{
- $cache_key = 'shop_' . $shop_id;
- $cached = $this->cache->get($cache_key);
+ $cached = $this->cache->get($shop_id);
if ($cached !== false) {
return $cached;
@@ -596,7 +595,7 @@
'artists' => $stats
];
- $this->cache->set($cache_key, $result);
+ $this->cache->set($shop_id, $result);
return $result;
}
@@ -715,7 +714,7 @@
*/
public function getAllShopsNews():array
{
- $cache_key = 'all_shops_counts';
+ $cache_key = 'all';
$cached = $this->cache->get($cache_key);
if ($cached !== false) {
--
Gitblit v1.10.0