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

Make just the object cache available / a simplified version of docket-cache #18

Open
hj-collab opened this issue Jun 30, 2023 · 4 comments

Comments

@hj-collab
Copy link

Hello there,

Thank you for creating such an amazing plugin. I have replaced all Redis instances with Docket Cache and using Syncthing to synchronize the object cache PHP files.

Is there any way I can use only the object cache file without the entire plugin? Alternatively, could you create a version of Docket Cache that only includes the core object caching features, excluding all other functionalities? I don't require the other features, and it becomes challenging to audit the entire plugin. Please let me know. Thank you!

@nawawi
Copy link
Owner

nawawi commented Jun 30, 2023

Hi,

Thank you for using Docket Cache.

You may disable any option on the configuration page, and then copy wp-content/docket-cache-data/options.php to use it later and for other sites.

That way you can just use Object Cache instead of creating a fork of this plugin.

Alternatively, you can try to edit includes/src/Plugin.php and find this code at the bottom file.

    public function register()
    {
        if (!$this->compat_notice()) {
            return;
        }
	$this->register_plugin_hooks();
        $this->register_admin_hooks();
        $this->register_tweaks();
        $this->register_cronjob();
        $this->register_cli();

        nwdcx_runaction('docketcache/init', $this);
    }

and comment-out $this->register_tweaks();

// $this->register_tweaks();

Hope this helps.

Thanks.

@hj-collab
Copy link
Author

hj-collab commented Jul 6, 2023

Hi @nawawi,

Thanks for your prompt response. I'll look into it.

I got interested in your plugin after reading the following article. Though it does not mention your plugin but do you think the results will be similar for your plugin vs redis? Have you ever benched them together? I understand your primary objective was to help people on shared hosting without redis support.

https://konstantin.blog/2021/redis-vs-memcached-vs-file_get_contents/

I believe the major reason behind this is the network requests / trips required to be made by Redis / Memcached. Using unix sock will be faster but then you lose features such as clustering.

Is there any benefit of storing the data like stats & options on filesystem ( wp-content/docket-cache-data/) instead of the database?

Best regards,

@nawawi
Copy link
Owner

nawawi commented Aug 17, 2023

Hi there, sorry for the late response.

do you think the results will be similar for your plugin vs redis?

Nope. Redis is better, it is server based.

Have you ever benched them together?

Nope. We can't compete with Redis.

Is there any benefit of storing the data like stats & options on filesystem ( wp-content/docket-cache-data/) instead of the database?

Docket Cache uses Constant as a configuration method. It is more reasonable to use a filesystem since it needs to load once WordPress loaded the object cache. And it is to avoid any issues with Database.

Thanks.

@hj-collab
Copy link
Author

Nope. Redis is better, it is server based.
Nope. We can't compete with Redis.

I found your plugin to be outperforming Redis and Memcached on a modern ryzen 7950x server. Redis has more moving parts (features) in general. I just required simple object caching with no cluster support, etc and your plugin is faster for me.

I had noticed similar results in a comparison from a wordpress core contributor. https://konstantin.blog/2021/redis-vs-memcached-vs-file_get_contents/

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

No branches or pull requests

2 participants