Which redis port to use for object caching or, other custom uses

Last Updated -


This article is to assist customers with using the proper redis port to use for object caching, or for any other use case requiring Redis access. Examples where you'd need to use this are with the redis-cache plugin, which you'd need to use if you want object caching when also using Advanced Custom Fields Pro - Currently Advanced Custom Fields does not work with Pagely's own Redis object-cache.php drop-in.

Many object caching plugins will default to port 6379. It is extremely important that port 6379 is not utilized. The answer is always to utilize 6380. Using port 6379 will lose important configuration data and cause your site(s) to become unavailable until that data gets reapplied.

As an example, here's how we would configure the redis-cache plugin:

1. Define the Redis Port and Cache Key

Note: This step must be performed before installing the redis-cache plugin.

Edit the wp-config.php file for the app you are working on. Add the define for the Redis port and the cache key. The cache key has to be unique for each app. Two apps can not share the same cache key.

define('WP_REDIS_PORT', 6380);
define('WP_CACHE_KEY_SALT','my-site-nickname-here');

These constants are specific to the redis-cache plugin. Please consult the documentation for any other plugins in order to determine the correct definitions it may need.

2. Install the Redis-Cache Plugin

https://wordpress.org/plugins/redis-cache/

You can install it via the WP dashboard or using the following command via the app root:

wp plugin install redis-cache 

3. Activate the Plugin and Verify the Redis Port/Cache Key are Correct

Log into the WP dashboard and activate the redis-cache plugin (this can also be done via command line). Once the plugin is activated go to Settings --> Redis on the left panel of the dashboard. In this section, verify the port is 6380 and that your cache key prefix is set. Once everything looks good, click "Enable Object Cache"

Related Topics

Pagely is the Managed WordPress Hosting Platform designed to exceed the needs of media, business, and Enterprise customers alike. We help the world's biggest brands scale WordPress.

Copyright © 2006-2017 Pagely, Inc. All rights reserved.
Pagely® and WordPress® are registered trademarks.

Pagely
Powered by Zendesk