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

Skip Redis object cache for auth endpoints. #747

Merged
merged 2 commits into from
Oct 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion public/app/object-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@
define( 'WP_REDIS_USE_RELAY', false );
}

// * There is a bug where auth transients are not being `set` or `get` correctly.
// It could be because auth endpoints `die()` early. So let's, skip the cache for auth endpoints.
$is_auth_uri = strpos($_SERVER['REQUEST_URI'], '/auth/') === 0;

// *
// Conditionally, run the script if the correct class exists, and the script has not been disabled.
if ( class_exists( WP_REDIS_USE_RELAY ? 'Relay\Relay' : 'Redis' ) && ( ! defined( 'WP_REDIS_DISABLED' ) || ! WP_REDIS_DISABLED ) ):
if ( !$is_auth_uri && class_exists( WP_REDIS_USE_RELAY ? 'Relay\Relay' : 'Redis' ) && ( ! defined( 'WP_REDIS_DISABLED' ) || ! WP_REDIS_DISABLED ) ):

if ( ! defined( 'WP_CACHE_KEY_SALT' ) ) {
define( 'WP_CACHE_KEY_SALT', '' );
Expand Down
Loading