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

Using common config #24

Open
dingman opened this issue May 13, 2020 · 5 comments
Open

Using common config #24

dingman opened this issue May 13, 2020 · 5 comments

Comments

@dingman
Copy link

dingman commented May 13, 2020

Great plugin, thank you so much for it.

I am wondering if you would be willing to support a common config between the object cache and the page cache plugins? Or maybe it already exists and I didn't see it

This is my current config to support both

$redis_page_cache_config = array();

// Change the cache time-to-live to 10 minutes
$redis_page_cache_config['ttl'] = 600;
$redis_page_cache_config['redis_host'] = 'xxxxxxxxxx.amazonaws.com';
$redis_page_cache_config['debug_data'] = true;
// Ignore/strip these cookies from any request to increase cachability.
//$redis_page_cache_config['ignore_cookies'] = array( 'wordpress_test_cookie', 'openstat_ref' );
$redis_page_cache_config['whitelist_cookies'] = array( 'test' );

// Ignore/strip these query variables to increase cachability.
//$redis_page_cache_config['ignore_request_keys'] = array( 'utm_source', 'utm_medium', );

// Vary the cache buckets depending on the results of a function call.
// For example, if you have any mobile plugins, you may wish to serve
// all mobile requests from a different cache bucket:


define('WP_REDIS_BACKEND_HOST', $redis_page_cache_config['redis_host'] );
@soulseekah
Copy link

There is no API compatibility between the two plugins, because the object cache plugin is a hard fork of an existing solution. We would like to maintain backward compatibility with it, so that people can just plugin n' play and switch out anytime.

But you idea is interesting. We can probably come up with something if more people need this. You're welcome to submit a patch as well.

Leaving open for consideration.

@dingman
Copy link
Author

dingman commented May 13, 2020

One idea is on the page cache plugin, to check if WP_REDIS_BACKEND_HOST is already set and if it is set, use that value instead of only the $redis_page_cache_config[] array for settings.

Thoughts?

@soulseekah
Copy link

It should be one of the default fallbacks in the configuration parser. If it's not explicitly set then check the WP_REDIS_BACKEND_HOST. Would you like to write the patch for this?

@dingman
Copy link
Author

dingman commented May 14, 2020

@soulseekah I appreciate the vote of confidence in me. I looked at the code and I'm not seeing the most appropriate way to patch it. Please do feel free to go ahead and patch it the correct way to the standards.

@dingman
Copy link
Author

dingman commented May 14, 2020

I read through the code again and proposed the change. Thanks!

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