prepare($query, ...$params); $result = $wpdb->query($sql); // Store the result in cache wp_cache_set($cache_key, $result, $cache_group, 60); } return $result; } public static function getResults($query, $params = [], $type = OBJECT) { global $wpdb; $cache_key = self::cacheKey($query, $params, $type); $cache_group = self::cacheGroup(); // Try to get the result from cache $result = wp_cache_get($cache_key, $cache_group); if ($result === false) { $sql = $wpdb->prepare($query, ...$params); $result = $wpdb->get_results($sql, $type); // Store the result in cache wp_cache_set($cache_key, $result, $cache_group, 60); } return $result; } }