Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: implement the runtime cache on preparePost functions. #951

Merged
merged 2 commits into from
Jun 14, 2024

Conversation

sebastianthulin
Copy link
Member

This fix, intends to improve performance by blocking and returning already knows results from runtime cache whenever a intentical request is made towards preparePostObject functions.

Skärmavbild 2024-06-13 kl  22 36 01

@@ -70,6 +84,16 @@ public static function preparePostObjectSingular(\WP_Post $post, $data = null):
*/
public static function preparePostObjectArchive(\WP_Post $post, $data = null): object
{
$cacheKey = $post->ID . '_' . serialize($data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ok for a key to contain all the different characters that may be generated from serialize?

@sebastianthulin sebastianthulin merged commit 4112021 into main Jun 14, 2024
6 checks passed
@sebastianthulin sebastianthulin deleted the fix/static-cache-prepare-post branch June 14, 2024 09:48
Copy link

sonarcloud bot commented Jun 14, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
2 Security Hotspots
100.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants