Skip to content

Commit 9077bf0

Browse files
authored
Object Cache Pro docsumentation updates (#9565)
* fix code block * add api_version to the yml code block * use a tablist to make it easier to distinguish composer vs non-composer instructions
1 parent 7379d2e commit 9077bf0

File tree

1 file changed

+40
-29
lines changed

1 file changed

+40
-29
lines changed

source/content/addons/object-cache/howto/wordpress.md

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ Run the command below to enable Redis via the command line with Terminus:
4646
terminus redis:enable <site>
4747
```
4848

49-
## Installation and Configuration for non-Composer WordPress Sites
49+
## Installation and Configuration
50+
51+
<TabList>
52+
53+
<Tab title="Standard WordPress" id="standard-wp" active={true}>
5054

5155
1. Ensure that your site is on a paid Performance or Elite plan. This can be verified by navigating to your **Pantheon Site Dashboard**, selecting **Settings**, selecting **About Site**, and then looking at the **Service Level**.
5256

@@ -102,27 +106,9 @@ terminus redis:enable <site>
102106

103107
</Alert>
104108

105-
### Database Cleanup (Required)
106-
By default, when Redis is not available on a WordPress site, WordPress stores [transient data](https://developer.wordpress.org/apis/transients/) in the database. Transients are bits of data that are intended to be stored _temporarily_ and then cleared automatically. When object caching like Redis is available, WordPress automatically stores transients into the object cache. However, after enabling Redis, any transients that previously existed in the database will not necessarily be cleared automatically, even when the cache is cleared. For sites that were live for awhile before Redis was enabled, there could be significant amounts of data in these tables. Removing this data could increase the speed of cloning, exporting, and backing up the database.
107-
108-
Use the following script to cleanup cache tables in the database:
109-
110-
<Download file="wp-db-cleanup-cache-tables.sh" />
111-
112-
```bash
113-
#!/bin/bash
114-
115-
echo 'Provide the site name (e.g. your-awesome-site), then press [ENTER]:';
116-
read SITE;
117-
118-
echo 'Provide the environment name (multidev, dev, test, or live), then press [ENTER]:';
119-
read ENV;
120-
121-
# Delete all transient options - these are now stored in Redis
122-
terminus wp $SITE.$ENV -- db query "DELETE FROM wp_options WHERE option_name LIKE ('%\_transient\_%');"
123-
```
109+
</Tab>
124110

125-
## Installation and Configuration for Composer-Managed WordPress Sites
111+
<Tab title="Composer-based WordPress" id="wordpress-composer">
126112

127113
Refer to the [official Object Cache Pro documentation](https://objectcache.pro/docs/composer-installation) for full configuration instructions.
128114

@@ -132,6 +118,7 @@ Refer to the [official Object Cache Pro documentation](https://objectcache.pro/d
132118
1. Open your `pantheon.yml` file and modify the `object_cache` entry or add an `object_cache` entry if there is not one already such that your `pantheon.yml` file includes:
133119

134120
```yaml
121+
api_version: 1
135122
object_cache:
136123
version: 6.2
137124
```
@@ -145,16 +132,16 @@ Refer to the [official Object Cache Pro documentation](https://objectcache.pro/d
145132
146133
This will pull the Object Cache Pro license token directly into the `auth.json` file. You can open the `auth.json` file locally to ensure that it has a structure that looks like this:
147134
148-
```json
149-
{
150-
"http-basic": {
151-
"objectcache.pro": {
152-
"username": "token",
153-
"password": "<LICENSE-TOKEN>"
154-
}
135+
```json
136+
{
137+
"http-basic": {
138+
"objectcache.pro": {
139+
"username": "token",
140+
"password": "<LICENSE-TOKEN>"
155141
}
156142
}
157-
```
143+
}
144+
```
158145
159146
<Alert title="Note" type="info">
160147
@@ -312,6 +299,30 @@ Refer to the [official Object Cache Pro documentation](https://objectcache.pro/d
312299
313300
1. See the ["Database Cleanup" section above](#database-cleanup-required) for steps on how to truncate the existing cache tables to make sure the latest data populates object cache properly.
314301
302+
</Tab>
303+
304+
</TabList>
305+
306+
### Database Cleanup (Required)
307+
By default, when Redis is not available on a WordPress site, WordPress stores [transient data](https://developer.wordpress.org/apis/transients/) in the database. Transients are bits of data that are intended to be stored _temporarily_ and then cleared automatically. When object caching like Redis is available, WordPress automatically stores transients into the object cache. However, after enabling Redis, any transients that previously existed in the database will not necessarily be cleared automatically, even when the cache is cleared. For sites that were live for awhile before Redis was enabled, there could be significant amounts of data in these tables. Removing this data could increase the speed of cloning, exporting, and backing up the database.
308+
309+
Use the following script to cleanup cache tables in the database:
310+
311+
<Download file="wp-db-cleanup-cache-tables.sh" />
312+
313+
```bash
314+
#!/bin/bash
315+
316+
echo 'Provide the site name (e.g. your-awesome-site), then press [ENTER]:';
317+
read SITE;
318+
319+
echo 'Provide the environment name (multidev, dev, test, or live), then press [ENTER]:';
320+
read ENV;
321+
322+
# Delete all transient options - these are now stored in Redis
323+
terminus wp $SITE.$ENV -- db query "DELETE FROM wp_options WHERE option_name LIKE ('%\_transient\_%');"
324+
```
325+
315326
## Local configuration with Lando
316327
Lando's [Pantheon recipe](https://docs.lando.dev/plugins/pantheon/) includes Redis in its Docker configuration. However, to get Object Cache Pro to work correctly with Lando locally, you'll need to make a few changes to your Object Cache Pro and Lando configuration.
317328

0 commit comments

Comments
 (0)