goatherd/gh-cache

Generic request cache layer for wordpress and nginx modules.

Installs: 60

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 3

Type:wordpress-plugin

1.0 2014-05-15 13:39 UTC

This package is not auto-updated.

Last update: 2024-03-16 12:17:46 UTC


README

WordPress request cache layer.

By default serves nginx reverse proxy/ fastcgi cache modules but is extendedable to use any request caching backend.

Features

  • generic request cache layer
  • cache, cache-veto and purge events
  • prepare event on plugins loaded hook
  • defines time-to-live filter (with implicite veto for non-positive times)
  • default event handlers (cache, veto, purge)

Requirements

  • PHP 5.3 or newer
  • WordPress 3.8+ (may work with older releases)

Default configuration features

  • enables proxy caching through X-accel-expires header
  • flushes cache on comment
  • flushes cache on post publish/ edit
  • flush some related posts by default
  • selectivly bypasses cache
  • can veto through gh-cache-veto filter
  • can override time-to-live through gh-cache-ttl filter
  • can extend purge to cover related URLs

Requirements

  • nginx
  • php curl module
  • can edit vhost configuration

Installation

  • TODO explain nginx config (simple)
  • TODO explain nginx config (full)
  • TODO explain nginx config (advanced purge for nginx 1.5.7+ and purge module)

Incompatibilities

  • Set-Cookie headers prevent caching If your WordPress installation relies on sessions caching will be rather limited or impossible to archive

  • Cache is flushed by URL: one-at-a-time If your WordPress installation requires huge networks of related posts to be flushed you should use other methods

  • Your WordPress installation is required to be cacheable. The most common criteria is to serve static content (and AJAX dynamic parts) for the majority of requests.

  • Not intended for user (agent) level caching

Technical Notes

PSR-4 compliant code approximating SOLID priciples.

Currently only nginx proxy and fastcgi caching is supported.

Due to limitations of the nginx cache implementation URLs can only be flushed one-at-a-time. Wildcard flush or full flush is not directly supported.