B
B
Bodrosh2020-11-30 14:15:10
PHP
Bodrosh, 2020-11-30 14:15:10

How to cache the executed part of php code?

Hello, I'm struggling with the problem of long site loading on WP, the bottleneck is in the loop (~ 1500 iterations) the register_taxonomy function is executed - it creates a PHP class object.
Is it possible to somehow cache this moment? Those. the result of executing a function or a complete loop?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
ThunderCat, 2020-11-30
@Bodrosh

You can't cache the loop, of course, but the result can be, for example, using serialize(), if there really is an object.

A
Alex, 2020-11-30
@Kozack

https://wordpress.org/plugins/wp-super-cache/

A
Artem Zolin, 2020-11-30
@artzolin

It seems to me that you are looking for wp_cache_set()and wp_cache_add(), but wp_cache_get()in order to receive data

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question