I advise you take a look at Upper for Craft 3 by the wonderful Oliver Stark.
Make Craft fly. Well, stick a reverse proxy in front of it then auto-magically invalidate the right caches.
To install Falcon, follow these steps:
- Download & unzip the file and place the
falcon
directory into yourcraft/plugins
directory - -OR- do a
git clone https://github.com/joshangell/falcon.git
directly into yourcraft/plugins
folder. You can then update it withgit pull
- -OR- install with Composer via
composer require joshangell/falcon
- Install plugin in the Craft Control Panel under Settings > Plugins
- The plugin folder should be named
falcon
for Craft to see it. GitHub recently started appending-master
(the branch name) to the name of the folder for zip file downloads. - Copy the code below into
craft/app/etc/templating/BaseTemplate.php
, inserting it afterif ($cacheService) { ... }
in the_includeElementInTemplateCaches
method:
$falcon = craft()->getComponent('falcon_templates', false);
if ($falcon) {
$falcon->includeElement($elementId);
}
Yes that was a core hack, which is always necessary on Craft 2.
Falcon works on Craft 2.4.x and Craft 2.5.x.
Currently very un-configurable.
The Varnish URL is set to http://0.0.0.0:8080/
, the headers used are xkey
specific, silly things are happening like Matrix blocks are getting their IDs sent out, there are no Tasks and custom keys aren’t purged.
But hey, this is basically still classed as an experiment.
You need to do this in your layout:
{% falcon %}
<!DOCTYPE html>
<html>
<head>...</head>
<body>
...
</body>
</html>
{% endfalcon %}
Then elsewhere:
{% extends "_layout" %}
{% falcon_addkey 'section:news' %}
{% block content %}
...
{% endblock %}
-Insert text here-
These things need to happen before it can be considered ready for use:
- Listen to specific entry on save, if new, send
section:handle
purge requests or whatever we do when doing the extra tagging during render. - Probably expand that whole thing to be configurable so that people can do whatever they like.
- Make the xkey header bit configurable, as well as the actual purge tooling so that we can swap between fastly and BYO varnish.
- Make cache interface configurable incl URL and type of interface.
- Send PURGEs as Task so they can be queued up.
- Check a configurable list of dis-allowed element types to ignore from auto element ID collection, like Matrix/Neo/SuperTable blocks.
- Make a Craft 3 version without a core hack. Brandon said something about swapping out core components once that makes me think this is possible.
Brought to you by Josh Angell