advanced-post-cache icon indicating copy to clipboard operation
advanced-post-cache copied to clipboard

Increasing number of queries?

Open cemiltr opened this issue 1 year ago • 3 comments

Hi. I added in theme:

<?php echo get_num_queries(); ?>

But when I activate the plugin**, the number of queries increases?**

Shouldn't the number of queries be reduced? thanks

cemiltr avatar Jul 01 '23 16:07 cemiltr

Do you have a persistent object cache? If not this may not work the way you think it does

On Sat, 1 Jul 2023 at 17:43, cemiltr @.***> wrote:

Hi. I added in theme:

And then I activated the plugin. But when I activate the plugin, the number of queries increases?

Shouldn't the number of queries be reduced? thanks

— Reply to this email directly, view it on GitHub https://github.com/Automattic/advanced-post-cache/issues/29, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAAOLZZUN3UJYTIK7GEWXPDXOBHUJANCNFSM6AAAAAAZ24STZI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

tomjn avatar Jul 02 '23 20:07 tomjn

I am not using any other plugin. I just wanted to try this plugin. the number of queries increased, this did not seem normal to me. thanks

cemiltr avatar Jul 02 '23 21:07 cemiltr

if you don't have a persistent object cache then anything advanced post cache tries to cache goes in WP_Cache and then is wiped at the end of the request. You need a persistent object cache to be able to use this, the same way batcache requires it, it isn't a standalone plugin.

That's why your queries go up, it's priming the cache with WP_Query data on every request, but there's no persistence on your install because you don't have a persistent object cache set up.

You should set up a Redis/Memcached object cache drop in file before using this repo

tomjn avatar Jul 02 '23 22:07 tomjn