Skip to content

Commit d82cba9

Browse files
authored
Merge pull request #24 from wp-cli/18-explain-site-transients
Better explain site transients in docs
2 parents 5b5656b + 9386d13 commit d82cba9

File tree

2 files changed

+56
-10
lines changed

2 files changed

+56
-10
lines changed

README.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,8 +334,13 @@ wp transient
334334
~~~
335335

336336
By default, the transient cache uses the WordPress database to persist values
337-
between requests. When a persistent object cache drop-in is installed, the
338-
transient cache also uses the WordPress Object Cache.
337+
between requests. On a single site installation, values are stored in the
338+
`wp_options` table. On a multisite installation, values are stored in the
339+
`wp_options` or the `wp_sitemeta` table, depending on use of the `--network`
340+
flag.
341+
342+
When a persistent object cache drop-in is installed (e.g. Redis or Memcached),
343+
the transient cache skips the database and simply wraps the WP Object Cache.
339344

340345
**EXAMPLES**
341346

@@ -369,13 +374,18 @@ Deletes a transient value.
369374
wp transient delete [<key>] [--network] [--all] [--expired]
370375
~~~
371376

377+
For a more complete explanation of the transient cache, including the
378+
network|site cache, please see docs for `wp transient`.
379+
372380
**OPTIONS**
373381

374382
[<key>]
375383
Key for the transient.
376384

377385
[--network]
378-
Delete the value of a network transient, instead of that on a single site.
386+
Delete the value of a network|site transient. On single site, this is
387+
is a specially-named cache key. On multisite, this is a global cache
388+
(instead of local to the site).
379389

380390
[--all]
381391
Delete all transients.
@@ -407,6 +417,9 @@ Gets a transient value.
407417
wp transient get <key> [--format=<format>] [--network]
408418
~~~
409419

420+
For a more complete explanation of the transient cache, including the
421+
network|site cache, please see docs for `wp transient`.
422+
410423
**OPTIONS**
411424

412425
<key>
@@ -424,7 +437,9 @@ wp transient get <key> [--format=<format>] [--network]
424437
---
425438

426439
[--network]
427-
Get the value of the network transient, instead of the single site.
440+
Get the value of a network|site transient. On single site, this is
441+
is a specially-named cache key. On multisite, this is a global cache
442+
(instead of local to the site).
428443

429444
**EXAMPLES**
430445

@@ -446,6 +461,9 @@ wp transient set <key> <value> [<expiration>] [--network]
446461

447462
`<expiration>` is the time until expiration, in seconds.
448463

464+
For a more complete explanation of the transient cache, including the
465+
network|site cache, please see docs for `wp transient`.
466+
449467
**OPTIONS**
450468

451469
<key>
@@ -458,7 +476,9 @@ wp transient set <key> <value> [<expiration>] [--network]
458476
Time until expiration, in seconds.
459477

460478
[--network]
461-
Set the transient value on the network, instead of single site.
479+
Set the value of a network|site transient. On single site, this is
480+
is a specially-named cache key. On multisite, this is a global cache
481+
(instead of local to the site).
462482

463483
**EXAMPLES**
464484

@@ -478,6 +498,9 @@ wp transient type
478498
Indicates whether the transients API is using an object cache or the
479499
options table.
480500

501+
For a more complete explanation of the transient cache, including the
502+
network|site cache, please see docs for `wp transient`.
503+
481504
**EXAMPLES**
482505

483506
$ wp transient type

src/Transient_Command.php

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@
44
* Adds, gets, and deletes entries in the WordPress Transient Cache.
55
*
66
* By default, the transient cache uses the WordPress database to persist values
7-
* between requests. When a persistent object cache drop-in is installed, the
8-
* transient cache also uses the WordPress Object Cache.
7+
* between requests. On a single site installation, values are stored in the
8+
* `wp_options` table. On a multisite installation, values are stored in the
9+
* `wp_options` or the `wp_sitemeta` table, depending on use of the `--network`
10+
* flag.
11+
*
12+
* When a persistent object cache drop-in is installed (e.g. Redis or Memcached),
13+
* the transient cache skips the database and simply wraps the WP Object Cache.
914
*
1015
* ## EXAMPLES
1116
*
@@ -34,6 +39,9 @@ class Transient_Command extends WP_CLI_Command {
3439
/**
3540
* Gets a transient value.
3641
*
42+
* For a more complete explanation of the transient cache, including the
43+
* network|site cache, please see docs for `wp transient`.
44+
*
3745
* ## OPTIONS
3846
*
3947
* <key>
@@ -51,7 +59,9 @@ class Transient_Command extends WP_CLI_Command {
5159
* ---
5260
*
5361
* [--network]
54-
* : Get the value of the network transient, instead of the single site.
62+
* : Get the value of a network|site transient. On single site, this is
63+
* is a specially-named cache key. On multisite, this is a global cache
64+
* (instead of local to the site).
5565
*
5666
* ## EXAMPLES
5767
*
@@ -80,6 +90,9 @@ public function get( $args, $assoc_args ) {
8090
*
8191
* `<expiration>` is the time until expiration, in seconds.
8292
*
93+
* For a more complete explanation of the transient cache, including the
94+
* network|site cache, please see docs for `wp transient`.
95+
*
8396
* ## OPTIONS
8497
*
8598
* <key>
@@ -92,7 +105,9 @@ public function get( $args, $assoc_args ) {
92105
* : Time until expiration, in seconds.
93106
*
94107
* [--network]
95-
* : Set the transient value on the network, instead of single site.
108+
* : Set the value of a network|site transient. On single site, this is
109+
* is a specially-named cache key. On multisite, this is a global cache
110+
* (instead of local to the site).
96111
*
97112
* ## EXAMPLES
98113
*
@@ -115,13 +130,18 @@ public function set( $args, $assoc_args ) {
115130
/**
116131
* Deletes a transient value.
117132
*
133+
* For a more complete explanation of the transient cache, including the
134+
* network|site cache, please see docs for `wp transient`.
135+
*
118136
* ## OPTIONS
119137
*
120138
* [<key>]
121139
* : Key for the transient.
122140
*
123141
* [--network]
124-
* : Delete the value of a network transient, instead of that on a single site.
142+
* : Delete the value of a network|site transient. On single site, this is
143+
* is a specially-named cache key. On multisite, this is a global cache
144+
* (instead of local to the site).
125145
*
126146
* [--all]
127147
* : Delete all transients.
@@ -181,6 +201,9 @@ public function delete( $args, $assoc_args ) {
181201
* Indicates whether the transients API is using an object cache or the
182202
* options table.
183203
*
204+
* For a more complete explanation of the transient cache, including the
205+
* network|site cache, please see docs for `wp transient`.
206+
*
184207
* ## EXAMPLES
185208
*
186209
* $ wp transient type

0 commit comments

Comments
 (0)