Etc cache - Cache plugin for Textpattern CMS

Overview

etc_cache

Download | Packagist

This Textpattern plugin provides an events-driven cache solution for Textpattern CMS.

Textpattern is fast, but when you have thousands of articles, processing the whole list (say, for creating a sitemap) can become time consuming. It’s a good idea (unless you publish an article every minute) to cache the processed result. Naturally, the cached block must be updated when content/an article is added/deleted. Most caching plugins trigger this update when the corresponding page is visited after the site update – this has, however, two inconveniences:

  1. The first visitor has to wait while the expired block is processed and cached again
  2. Every site modification, even irrelevant to the cached content, yields the cache update

That’s what etc_cache is aimed to solve.

Installing

Using Composer:

$ composer require etc-plugins/etc_cache:*

Or download the latest version of the plugin from the GitHub project page, paste the code into the Textpattern Plugins administration panel, install and enable the plugin. Visit the forum thread for more info or to report on the success or otherwise of the plugin.

Requirements

  • Textpattern 4.6.0 or newer.

Tags

The basic usage is:

<txp:etc_cache id="heavycode">
    ...heavy code...
</txp:etc_cache>

Attributes

  • id="id name"
    A unique identifier name for this cached item.
  • reset="value"
    See reset information below.
  • time="value"
    See time information below.

The code will be processed and cached until the site is updated. On site update, the plugin (if configured so) will ping the URL containing this block, triggering the cache refresh. Hence, the cache will always stay up to date, without penalizing site visitors.

To configure automatic cache updates, visit Extensions region Cache administration panel and edit reset field of each block. The possible values are:

  • (empty): update client-side only when expired, regardless the site updates
  • 1: (default) update client-side if expired or the site was updated
  • a list of events like article_posted, article_saved or SQL LIKE pattern like article%: update server-side when a matching event is fired.

The value % thus means ‘auto-update on each site update’, but will act as 1 client-side too.

You can be more specific with cache reset criteria. Say, if you need a block to be reset only if the article 3 is updated, set:

reset: article_saved
filter: {"article_saved":{"ID":3}}

You can also pass a reset attribute directly to etc_cache:

<txp:etc_cache id="archive" reset="article%">
    ...heavy code building an articles archive...
</txp:etc_cache>

If needed, one can pass a time attribute to etc_cache:

<txp:etc_cache id="dailycode" time="+1 day">
    ...daily code...
</txp:etc_cache>

A positive (relative) value of time will indicate that the cache (even a fresh one) must be reset on site update.

An absolute value like time='<txp:modified format="%F %T" gmt="1" /> +1 month' will mean ‘cache it if not modified since one month’.

A negative value will not observe site updates, for example (-900 seconds is equiavlent to 15 minutes):

…feed code…

Authors/credits

Written by Oleg Loukianov. Many thanks to all additional contributors.

You might also like...
Tom image grid - Plugin for Textpattern CMS : An optionnal grid display for images tab

tom_image_grid tom_image_grid is a plugin for Textpattern CMS. It allows a more compact display (as a grid) of the images list. The plugin adds two bu

A Magento 1.x module which facilitates automatic purging of static assets from HTTP caches such as browser cache, CDN, Varnish, etc using best practices outlined within the HTML5 boilerplate community.

Magento Cachebuster Cachebuster is a Magento module which facilitates automatic purging of static assets from HTTP caches such as browser cache, CDN,

Rah backup - Takes backups from Textpattern CMS installations

rah_backup Packagist | Twitter | Donate Rah_backup keeps your important site safe from disastrous events. Rah_backup is an admin-side backup utility p

Rah sitemap - XML sitemap generator for Textpattern CMS

rah_sitemap Packagist | Issues | Donate Sitemap plugin for Textpattern CMS. Generates Sitemaps.org XML sitemaps for your site, which help Google and o

Rah memcached - Store parts of Textpattern CMS templates in Memcached

rah_memcached Packagist | Issues | Donate A plugin for Textpattern CMS that stores parts of your templates in Memcached, a distributed in-memory key-v

Oui player - Manage configurable media players in @Textpattern CMS

oui_player Introduction An extendable plugin to easily embed customized audio and video players. . This plugin does not use oembed, it builds iframe e

Rah comments - Paginated article comments list for Textpattern CMS

rah_comments Download | Packagist | Issues | Support forum | Donate Rah_comments lets you to paginate Textpattern CMS’ comment lists, splitting the lo

Rah privileges - Configure Textpattern CMS' user-group privileges through Preferences panel

rah_privileges Packagist | Donate Configure admin-side user-group permissions from Textpattern CMS’ preferences panel. Install Using Composer: $ compo

The Cache component provides an extended PSR-6 implementation for adding cache to your applications.

Symfony PSR-6 implementation for caching The Cache component provides an extended PSR-6 implementation for adding cache to your applications. It is de

Comments
  • Register at Packagist and hook into repo

    Register at Packagist and hook into repo

    Hi @bloatware - can you register this repo with Packagist using your account there and hook up as per what we did on etc_paginate. I can then test the Composer installation works.

    Cheers, Phil.

    opened by philwareham 4
Releases(0.2.8)
Etc pagination - Pagination plugin for Textpattern CMS.

etc_pagination Download | Packagist This Textpattern plugin creates a paginated navigation bar on listings. It has a wide variety of attributes – so y

null 5 Dec 10, 2020
Textpattern-for-Panic-Coda - A Textpattern CMS mode for Panic Coda

Textpattern elements for Panic Coda 2 Handy elements for use with Panic Coda 2 on a Mac when authoring files for the Textpattern CMS. This repository

Phil Wareham 8 Jun 26, 2017
Rah cache - Cache Textpattern's dynamic pages as flat files

rah_cache Packagist | Issues Rah_cache is a simple, experimental full-page caching plugin for Textpattern CMS. It caches Texpattern’s dynamic pages as

Jukka Svahn 2 Apr 24, 2022
Textpattern-installer - Textpattern plugin and theme installer for Composer

Textpattern Installer for Composer Package directory | Issues Install plugins and themes to Textpattern CMS with Composer. $ composer require rah/rah_

Jukka Svahn 7 Apr 14, 2022
Ied plugin composer - Inspired Plugin Composer: Create, publish and edit plugins from within Textpattern CMS.

ied_plugin_composer Create, publish and edit plugins from within Textpattern CMS. Creates a new page under the Extensions tab where you can edit and e

Stef Dawson 8 Oct 3, 2020
MassPlugCompiler - Textpattern CMS plugin compiler

mtxpc mtxpc compiles Textpattern CMS plugin sources into installer packages. Supports multi-file structure and a JSON manifest file. Install Using Com

Jukka Svahn 5 Apr 15, 2022
Smd imagery - A Textpattern CMS plugin for managing images in the Write panel.

smd_imagery Insert images into your Write panel. Very handy for people who run photoblog or image-heavy sites, or those who categorise images for incl

Stef Dawson 5 Nov 15, 2022
Zem contact reborn - An extensible HTML form mailer plugin for Textpattern CMS.

com_connect Contents Introduction Installing and upgrading Migrating from zem_contact_reborn Usage Tags com_connect tag com_connect_text tag com_conne

Textpattern CMS 23 Dec 8, 2021
Smd tags - A Textpattern CMS plugin for unlimited, structured taxonomy across content types.

smd_tags Tag articles, images, files and links with stuff, then use the public-side tags to display the lists, filter or find related content. Feature

Stef Dawson 4 Dec 26, 2022
Rah comment spam - Comment anti-spam plugin for Textpattern CMS

rah_comment_spam Packagist | Issues | Donate Rah_comment_spam provides customizable anti-spam tools for Textpattern CMS’ comment system. Set minimum a

Jukka Svahn 2 Apr 24, 2022