WpW: Using LSCache with the WordPress CLI

WordPress Wednesday: Using LSCache with the WordPress CLI

Written by

in

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 the shop.example.com cache (stored as blog id 2):
    wp litespeed-purge blog 2
  • tag purges the listed WordPress tags by ID. For example, purge the tag IDs 1, 3, and 5:
  • wp litespeed-purge tag 1 3 5
  • category purges the listed WordPress categories by ID. For example, purge the category ids 1, 3, and 5:
    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 ids 1, 3, and 5:
    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:

Comments

4 responses to “WpW: Using LSCache with the WordPress CLI”

  1. Recep Baltas Avatar

    Have LSCache installed but WP-CLI says
    Error: ‘lscache-purge’ is not a registered wp command. See ‘wp help’ for available commands.

    Update your half-ass guide please.

    1. Lisa Clarke Avatar
      Lisa Clarke

      If you are using v3 of the plugin, you will want to see this documentation, as the CLI commands have changed.

  2. Martin Avatar
    Martin

    Can wp-cli be used to start the crawler?

    1. Lisa Clarke Avatar
      Lisa Clarke

      Hi, Martin. Currently there is no way to start the crawler with WP CLI, however we are planning to add this functionality soon!

Leave a Reply

Your email address will not be published. Required fields are marked *