WpW: Using LSCache with the WordPress CLI
Welcome to another installment of WordPress Wednesday!
Today’s topic is: Using LSCache with the WordPress CLI
Disclaimer: The information contained in this post is accurate as of LSCWP v3.5.2 [release log]. If you are using a later version, the commands may have changed. Please refer to our documentation.
WP-CLI is the command-line interface for WordPress. It allows you to perform many actions that would normally require you to visit the WordPress Dashboard in a browser. LiteSpeed’s WP-CLI commands that allow you to manage your cache simply from the command line, and with version 3.0 of our plugin, we have expanded these options considerably.
This is just a taste of the commands available. For the full list, including CLI commands for QUIC Cloud services and debugging purposes, please see our documentation.
Option Commands
Use litespeed-option
plus these commands to view and change LSCache’s configuration.
all
allows you to see what options are available:wp litespeed-option all
export
sends all of the options to a file:wp litespeed-option export
set
allows you to change a particular option to a particular value. (It might be handy to export the options first, so that you know what each option is named, and what type of value is expected.):wp litespeed-option set cache-priv false
import
configures LSCache according to the options in a specified file:wp litespeed-option import options.txt
Purge Commands
Use litespeed-purge
plus these commands to purge specific entries from the cache.
network_list
displays all of the site domains and IDs in a table:wp litespeed-purge network_list
all
purges all cache entries associated with the WordPress installation. For networks, purges all cache entries for every site in the network:wp litespeed-purge all
blog
purges all cache entries for a particular blog ID. For example, in a multisite install, purge only theshop.example.com
cache (stored as blog id2
):wp litespeed-purge blog 2
tag
purges the listed WordPress tags by ID. For example, purge the tag IDs1
,3
, and5
:wp litespeed-purge tag 1 3 5
category
purges the listed WordPress categories by ID. For example, purge the category ids1
,3
, and5
:wp litespeed-purge category 1 3 5
post_id
purges all cache tags related to the listed WordPress Posts or Products by ID. For example, purge the post ids1
,3
, and5
:wp litespeed-purge post_id 1 3 5
—
Have some of your own ideas for future WordPress Wednesday topics? Leave us a comment!
Don’t forget to meet us back here next week for the next installment. In the meantime, here are a few other things you can do:
- Subscribe to the WordPress Wednesday RSS feed
- Download LiteSpeed Cache for WordPress plugin
- Learn more about the plugin on our website
Comments