Tag: browser cache

  • WpW: LSCache New Feature Roundup!

    WpW: LSCache New Feature Roundup!

    WordPress Wednesday LSCache New Features

    Welcome to another installment of WordPress Wednesday!

    Disclaimer: The information contained in this post is accurate for LSCWP v1.6.6 [release log]. If you are using a newer version of the plugin, some details may have changed. Please refer to our wiki for the latest!

    Throughout the last several months, you may have gotten whiplash watching us release new feature after new feature in our LSCache plugin for WordPress! It’s been a whirlwind, we know. We’re at a point now where most of the big stuff been implemented, so I thought it might be a good time to give you a quick guided tour.

    First, I’ll share links to the blog posts we’ve written about the major new features, so you can read up on them in depth, and then I’ll show you some of the smaller things that didn’t get their own posts but are worth a mention just the same.

    Big Feature Roundup

    Check out the linked blog posts to learn all about the following new cache functionality and optimization features:

    Other Features You Might Like

    There are a handful of other new features that didn’t get their own blog posts. We’ve got an interface enhancement, a private cache feature, a new type of URL to exclude, and a collection of new optimization options.

    Tab Switch Shortcut

    WordPress Wednesday LSCache New Feature Tab Switch Shortcut

    We’ve got a lot of tabs in our settings at this point, so you might appreciate the ability to easily switch between tabs, if you’re more of a keyboard-user than a mouse-user.

    As long as your cursor is not focused on an input element, you can type a number, and be brought directly to the corresponding tab. For example, if you’re looking at the General tab, but want to change something in the ESI tab, simply press 9 and you will be brought to the ESI tab.

    Private Cached URIs

    From the WordPress dashboard, navigate to LiteSpeed Cache > Settings > Cache and scroll to the bottom of the page.

    WordPress Wednesday LSCache New Feature Private Cached URIs

    You may have pages on your site that would default to public cache under normal circumstances, but which you think should be cached privately (i.e. a separate copy cached for each individual user).

    Use this box to list such URI’s, one per line. You can list an entire path and place a $ after it so that it is interpreted as an exact URI. Otherwise, any URI that includes the path you enter will be privately cached.

    For example:

    reviews/canon/$ will only match reviews/canon/.

    reviews/canon/ will match reviews/canon/ and reviews/canon/eos80d/.

    Additional Excludes

    From the WordPress dashboard, navigate to LiteSpeed Cache > Settings > Excludes.

    WordPress Wednesday LSCache New Feature Additional Excludes

    Query Strings

    You can eliminate URLs with certain query strings from being cached.

    For example, let’s say you have a mechanism that allows you to colorize your site in a purple color scheme like so: http://example.com/page?color=purple.

    if you don’t want to cache any page that is rendered in a colorized way, you could enter color in that list. That would match http://example.com/page?color=purple as well as http://example.com/page?color=red, or any other specified color, and those pages would be excluded from caching.

    From the WordPress dashboard, navigate to LiteSpeed Cache > Settings > Excludes and scroll to the bottom of the page.

    Roles

    There may be user roles that you wish to exclude from caching. For example, if you are an admin testing new functionality, you may want to exclude your administrator role from being served from cache until your testing is through.

    Load JQuery Remotely

    From the WordPress dashboard, navigate to LiteSpeed Cache > Settings > CDN and scroll to the bottom of the page.

    WordPress Wednesday LSCache New Feature Load JQuery Remotely

    It can be faster to load JQuery from a remote CDN service. You may choose one here.

    Optimization and Tuning

    When we first released the Optimize tab, we wrote up a full blog post on all of the options. After that we added some new settings to the page. And then we added some more. And then, because that page was getting a bit unruly, we split Optimize into Optimize and Tuning.

    So, if the last time you saw Optimize was while reading that blog post, you’ll need to know that two of those settings we discussed (CSS Excludes and JS Excludes) now live on the Tuning page. The other functions remain on Optimize, along with several new ones.

    We recommend checking out both of those pages in our wiki’s Settings section, where every plugin setting is described in detail.

    Image Optimization

    Our image optimization feature is our newest one, and we’re still making adjustments here and there, based on what’s working well, what could use improvement, and the feedback we’ve received. Take a look at the Image Optimization page on our wiki to see how the most up-to-date features work.

    WordPress Wednesday LSCache New Features

    Thus ends our tour of the new features. Keep an eye on WordPress Wednesday in the future for more detailed exploration of various aspects of our plugin!

    For the most up-to-date configuration reference, you’ll want to keep the URL for our wiki handy. We make an effort to publish updates to the wiki as soon as anything changes in the plugin. While it might take us a few weeks to write an in-depth blog post, the wiki gets updated immediately.

    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:

  • WpW: Using Browser Cache in LSCache

    WpW: Using Browser Cache in LSCache

    Welcome to another installment of WordPress Wednesday!

    Today we are going to talk about another enhancement to the LSCache plugin for WordPress: Browser Caching! We’ll talk a little bit about how browser caching is different than page caching (LSCWP’s specialty), but if you’d like a more in-depth exploration of the topic, you should take a look at our Caching 101 series.

    Why Browser Caching?

    LiteSpeed Cache is a full-page cache. It takes expensive-to-generate dynamic content and stores it as easy-to-serve static files. While it handles dynamically-generated content well, it only handles dynamically-generated content. Static content such as images, video, or fonts is not included in a page cache. And yet, this content may be requested from the server repeatedly. Take, for instance, your site’s logo. That image is likely to be displayed on every page that the user visits, which means the server has to transfer that same image to that same user, over and over and over again.

    This is where browser caching comes in handy. With browser caching enabled, your logo (along with other static content) is stored locally on the user’s device the first time it is requested. After that, the content is pulled from the device’s local storage until the browser cache expires. Displaying a local image will always use fewer resources than transferring an image across the internet, no matter how fast your connection may be.

    How to Set it Up

    Normally, browser caching is enabled at the LiteSpeed Web Server level. However, if you do not have access to your server’s admin, you can still enable browser caching through the LSCWP plugin settings. You can choose to set this up at whichever level makes the most sense for your site(s).

    If browser caching is turned on at any level (server, plugin, or both) then it will be enabled.

    At the Plugin Level

    From the WordPress Dashboard, navigate to LiteSpeed Cache → Settings → Advanced and scroll down to Browser Cache.

    Set Browser Cache to ON.

    That’s it! Browser caching will now be enabled for your site. Most static files will be cached locally on the user’s device, and will expire after one month.

    At the Server Level

    If you are a server admin, you have somewhat more control. In the LiteSpeed Web Server Admin, navigate to Server > General and scroll down to Expires Settings.

    Set Enable Expires to Yes.

    Expires Default may be set to a number of seconds or left blank if you don’t wish to provide a catch-all expiration.

    Set Expires by Type to a string similar to the example shown, changing any file types or expiration times as desired. The example enables browser caching for all images, css, and javascript, and it sets all of their expirations to 604800 seconds (or one week). If you leave Expires Default blank, then you must specifically include every file type you want cached by the browser in Expires by Type.

    NOTE: Do not set a text/html Expires by Type, because that will interfere with LSCWP’s page cache.

    Once you have enabled browser caching using one of the above methods, your visitors should experience a performance boost, particularly if your site is image-heavy, or contains a large amount of other static files. Just remember, a browser cache operates like every other cache does: it needs to be populated before your users will see any benefit. So, the first time a visitor requests a page on your site, all of the static assets will still need to be transferred over the internet. For subsequent visits, any static files that have already been requested will now be available locally on the visitor’s device until they expire.

    If you have any questions or suggestions regarding this new feature, let us know in the comments section!

    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: