Jake Vanderwerf
2026-08-26 ccf5e61a075c35d24befc175994b5cb8957ca322
inc/meta/Storage.php
@@ -3,6 +3,7 @@
use Exception;
use JVBase\managers\Cache;
use JVBase\managers\Errors;
if (!defined('ABSPATH')) {
   exit;
@@ -163,14 +164,13 @@
         $this->wpdb->query('COMMIT');
         // Update post modified timestamp
         Cache::invalidateItem($item->objectType, $item->id);
         $this->clearCache($item);
         return true;
      } catch (Exception $e) {
         $this->wpdb->query('ROLLBACK');
         JVB()->error()->log('meta_storage', $e->getMessage(), [
         Errors::getInstance()->log('meta_storage', $e->getMessage(), [
            'item_id' => $item->id,
            'object_type' => $item->objectType,
            'fields' => array_keys($dirty)
@@ -326,7 +326,7 @@
            $results[$meta->item()->id ?? 'options'] = false;
         }
         JVB()->error()->log('meta_storage', 'Bulk save failed: ' . $e->getMessage(), [], 'error');
         Errors::getInstance()->log('meta_storage', 'Bulk save failed: ' . $e->getMessage(), [], 'error');
         return $results;
      }
@@ -609,12 +609,21 @@
   public function clearCache(Item $item): void
   {
      match ($item->objectType) {
         'post' => clean_post_cache($item->id),
         'term' => clean_term_cache($item->id),
         'user', 'integrations' => clean_user_cache($item->id),
         default => null
      };
      switch ($item->objectType) {
         case 'post':
            Cache::clearPost($item->id);
            clean_post_cache($item->id);
            break;
         case 'term':
            Cache::clearTerm($item->id);
            clean_term_cache($item->id);
            break;
         case 'user':
         case 'integrations':
            Cache::clearUser($item->id);
            clean_user_cache($item->id);
            break;
      }
   }
   // ─────────────────────────────────────────────────────────────