With the latest version of Alloy (v3.1.0) we're including a new feature aimed at helping speed things up for users with a lot of blog posts.
In this post we're going to talk about what Server Side Caching is, how it works and how to make use of it. Additionally we'll also take a look at some of the other changes we're shipping in this update as well. With that out of the way, let's dive in to caching.
As I was saying -- this update allows you to optionally enable a temporary cache of your Blog Posts to help speed up blogs that have an extremely large number of blog posts.
Normally, without Server Side Caching enabled, Alloy will read in each blog post one at a time as our page loads. This means sifting through our Posts folder, opening each individual post file, reading out its contents and then closing that file again.
This happens quite quickly, and is one of the reasons Alloy is so snaoppy already, but if we have thousands of posts this can slow things down some as we're repeating this process literally thousands of times.
The new Server Side Caching feature allows speed things up when dealing with huge blogs like this. It allows Alloy to read in all of your blog posts one time and write them to out to a single, temporary cache file on the server. This means we only need to open one file, retrieve all of our data and then close that file. This cuts out a huge amount of processing that Alloy needs to do. And it means we can still leave all of our individual posts as they are.
I've created a short video where I walk through this, as well as show you how to use the Server Side Caching feature. We also talk about how to use this feature with sites that are running multiple blogs.
Should I use Server Side Caching though?
If you've got a large blog, with a lot of posts, Server Side Caching might be good for you to check out. Most Alloy users though will not really need the Server Side Caching feature. If you have a small blog with a few hundred Blog Posts you'll probably not need this feature, as Alloy is really quick at loading its blog posts.
If your blog grows though and you find you've now got thousands of Blog Posts you may want to then enable caching, as this will help speed things up for you.
If you're going to use Server Side Caching, you will need to watch the video above.
What about Embeds and Droplets?
Unlike Blog Posts, Alloy's Embeds are individually loaded. We only pull in the specific data you Embed for each post. We don't need to parse other data like we need to with Blog Posts or Droplets, so caching is unnecessary for Emebds.
But what about Droplets you ask? Droplets do in fact support Server Side Caching as well. It is setup and used much the same as with Blog Posts, with the exception that since Droplets do not need an Alloy Control Center on the page the caching is enabled and configured in the Droplets stack itself.
We highly recommend watching the tutorial video above before diving into using Server Side Caching for your blog. We also have a reference page in the Alloy documentation that relates to Server Side Caching. It contains some of the information in this post, as well as the tutorial video. We also cover what the features in the Alloy Control Center, Editor and Droplets stacks do. That said, the tutorial video should cover the basics of setting up caching for your blog, which is what most users are likely going to be using this feature for, when needed for larger blogs.
Other updates in this release
As with most updates we've got several new features and updates that come in this version, with Server Side Caching being the main new feature. In fact many of these features have been held up waiting for Server Side Caching to be finished. Let's take a look at some of the changes in Alloy v3.1.0:
Alloy Control Center
- Adds in Server Side Caching for Blog Posts and Droplets. The first time the Blog Post data or Droplets would be shown the Control Center creates a temporary cache file which speeds up loading of these items for sites with a larger number of Blog Posts and Droplets.
- Edit mode topper now uses the macOS's system font.
- Fixes a bug that would cause the Go Back link to not show on Tag pages when placed at the top of the page.
- Adds the ability to adjust the font weight for both normal and inline list items.
- Images uploaded into your Blog Posts and Topper Images now have spaces removed from their filenames during upload. Spaces are replaced by underscores.
- Improves session login handling.
- Adds an Advanced setting that allows you to set the expiration time for Editor logins. Default is 1440 seconds (24 minutes). The maximum is 43,200 seconds (12 hours) and the minimum value is 600 seconds (10 minutes). For most use cases the default should suffice.
- Improves duplicate Topper Image upload file handling.
- Adds an optional Clear Alloy Cache button to the utility menu. This allows you to manually clear the server-side cache if needed.
- Fixes error where the Side-By-Side view button would show in the Custom Summary toolbar, which was unintended.
- Adds a setting in the Editor stack that allows you to turn on Side-By-Side mode for the main blog post body content by default when creating and editing a post.
- Adds the ability to have multiple lines of text within the Custom Summary field.
For a full run down of all changes in this version you can also visit the Alloy Release Notes page.