Support » Plugin: WP REST Cache » Make it even faster if possible

  • Resolved stevemoretz

    (@stevemoretz)


    Hi I’d like to propose a suggestion,
    I’m using mamp pro on macos Catalina and WordPress speed is really slow woocommerce api takes around 2 seconds each request I have no other plugin used also,just woocommerce.

    So I’m hoping that’s just because of mamp and it will be fine when goes on a server?

    Anyways, using this plugin I get 500ms instead of 2s so it’s really great but,I’m guessing this could even be faster depending on where and how the cache is stored and retrieved.

    Yet I don’t know even the cache is returned and how this plugin works.

    What I do know however is that using SHORTINIT and without loading anything from WordPress like in the main file which runs on every request,it could check for url and params if was cached then return.

    Using directly loading a php file without loading WordPress I get 20ms time load.

    And not using rest_api_init hook and return on my plugin itself I can get to 200ms.

    If it is saved in the database or a file using normal php and not loading all WordPress you still could get the results and return but dramatically faster.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Richard Korthuis

    (@rockfire)

    Hi @stevemoretz

    Thank you for using our plugin! And thank you for your suggestion to make it faster.

    When we initially developed this plugin we did investigate the SHORTINIT option, but ran into several problems. One of those (but there are more) problems (which is also the reason why your suggestion to directly loading a PHP file will also not be an option) is that you are losing a lot of WP functionality including the option for others to use filters to hook into the process. In our current implementation we are using the transients API to save our caches, this API allows our users to determine how they want the caches to be saved (default is database, but other options like memcached are available through plugins), this is more flexible than having it saved to PHP by default.

    So although it is indeed possible to increase the speed even more, we have decided it doesn’t outweigh the disadvantages,

    Thread Starter stevemoretz

    (@stevemoretz)

    I know what you are talking about but this is not a problem in this specific case what I’m saying is that you can know what the request contains without loading the WordPress at first if the request was already cached then just return the results otherwise load the WordPress.

    If the request was already cached you already return the results right?

    Why not check and return it even earlier?

    Plugin Author Richard Korthuis

    (@rockfire)

    This is still a problem in this specific case.

    you can know what the request contains without loading the WordPress at first

    How can we know if we are using the transient API? If we don’t load WordPress we do not have the transient API, so how to retrieve the transient without the API? In order to do so we would have to build our own implementation of the transient API which should be able to run without WordPress.

    Thread Starter stevemoretz

    (@stevemoretz)

    It’s actually possible.
    Transients are stored in wp_options table you can access it via raw Php,other than that you could use corcel which makes it pretty easy to work with WordPress using its database using laravel features.

    Currently I gave up on WordPress rest api and woocommerce rest api which takes 2 seconds to load, installed corcel now it takes 200 ms to load.

    Plugin Author Richard Korthuis

    (@rockfire)

    Well, yes transients are stored in de wp_options table by default. But once you start using memcached (or something else) the transients are no longer stored in de wp_options table. So you cannot assume they will be available in the database…

    Thread Starter stevemoretz

    (@stevemoretz)

    No problem still possible.

    Since you store the type in a file or database you already can get the type user is using.Like memcached.

    So now you don’t have WordPress but you know you have to use memcached,so all you need is to use memcached.

    Again things could be simple using Illuminate/Database a component from symfony which laravel uses,it already supports memcached as a driver and can get infinite drivers integrated with it.

    So still without using WordPress you can totally do this.

    If there isn’t any other problem though?

    • This reply was modified 3 years, 2 months ago by stevemoretz.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Make it even faster if possible’ is closed to new replies.