PHPackages                             evista/pj-page-cache-red - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. evista/pj-page-cache-red

ActiveWordpress-plugin

evista/pj-page-cache-red
========================

Redis backed page cache

v0.1.52(9y ago)1148MITPHPPHP ^7.0

Since Feb 19Pushed 9y ago2 watchersCompare

[ Source](https://github.com/balintsera/pj-page-cache-red)[ Packagist](https://packagist.org/packages/evista/pj-page-cache-red)[ RSS](/packages/evista-pj-page-cache-red/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (4)Versions (13)Used By (0)

Redis Page Cache for WordPress
==============================

[](#redis-page-cache-for-wordpress)

A Redis-backed full page caching plugin for WordPress, extremely flexible and fast. Requires a running [Redis server](http://redis.io/), a Redis client package (currently only [cheprasov/php-redis-client](https://packagist.org/packages/cheprasov/php-redis-client) is supported), and [Composer](http://http://getcomposer.org)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f2ee348eb2c27f5832b6a8ad3f2ba5fc9b659c3d15f87ed03d7919d78dd2e1b6/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6576697374612f706a2d706167652d63616368652d7265642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/evista/pj-page-cache-red) [![Build Status](https://camo.githubusercontent.com/57fe0e993236a3acc8ed2a3a7d71caeab4995efceded7424ffc1a10b2a72e3bd/68747470733a2f2f7472617669732d63692e6f72672f62616c696e74736572612f706a2d706167652d63616368652d7265642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/balintsera/pj-page-cache-red) [![Total Downloads](https://camo.githubusercontent.com/d5d65d0f36c1a4fdcfc24080da3a9601d689a510f3b90069860f78a91d8b952f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6576697374612f706a2d706167652d63616368652d7265642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/evista/pj-page-cache-red)

Requirements
------------

[](#requirements)

Redis server:

```
sudo apt-get install redis-server

```

This fork of the original package is being actively refactored to use a Redis package instead of the Redis PECL extension and to add some test coverage. My most important plan is to add an interface to hint the current dependency injection, and add more tests.

Make sure your Redis server has enough memory allocated to store your cached pages. The plugin compresses cached pages using gzip to lower memory usage. We recommend anywhere from 16 mb allocated just for page caching. Increase according to your hit-rate. We also recommend disabling flushing Redis cache to disk, and the `allkeys-lru` eviction policy to ensure the server can make more room for new cached pages by evicting older ones. Here is a sample extract from the redis.conf file:

```
maxmemory 16m
maxmemory-policy allkeys-lru

```

Don't forget to restart the Redis server after making changes to the configuration file.

Installing the WordPress Plugin
-------------------------------

[](#installing-the-wordpress-plugin)

Install the plugin via composer then activate it. It adds the advanced-cache.php file as a symlink into the wp-contents folder:

```
composer require evista/pj-page-cache-red

```

Enable page caching in your WordPress wp-config.php file with a constant:

```
define( 'WP_CACHE', true );
define('REDIS_CACHE', true);

```

Set up some important Redis options (both has defaults):

```
define('REDIS_CACHE_TTL', 3000);
define('REDIS_DB', 10);
define('REDIS_HOST', getenv('REDIS_HOST') ?: '127.0.0.1');
define('REDIS_PORT', getenv('REDIS_PORT') ?: 6379);
```

Try visiting your site in incognito mode or cURL, you should see an X-Pj-Cache- header:

```
curl -v https://example.org -o /dev/null
< X-Pj-Cache-Status: hit

```

That's it!

Purging Cache
-------------

[](#purging-cache)

By default, this plugin will expire posts (pages, cpt) whenever they are published or updated, including the front page and any RSS feeds. You may also choose to expire certain URLs or cache flags at certain other events. For example:

```
// Expire cache by post ID (argument can be an array of post IDs):
Redis_Page_Cache::clear_cache_by_post_id( $post->ID );

// Expire cache by URL (argument can be an array of URLs):
Redis_Page_Cache::clear_cache_by_url( 'https://example.org/secret-page/' );

// Expire cache by flag (argument can be an array):
Redis_Page_Cache::clear_cache_by_flag( array( 'special-flag' ) );

```

Wait, what the heck are flags?

Redis Page Cache stores a set of flags with each cached item. These flags allow the plugin to better target cached entries when flushing. For example, a single post can have multiple URLs (cache buckets, request variables, etc.) and thus, multiple cache keys:

```
https://example.org/?p=123
https://example.org/post-slug/
https://example.org/post-slug/page/2/
https://example.org/post-slug/?show_comments=1

```

These URLs will have unique cache keys and contents, but Redis Page Cache will flag them with a post ID, so you can easily purge all three items if you know the flag:

```
$post_id = 123;
$flag = sprintf( 'post:%d:%d', get_current_blog_id(), $post_id );

Redis_Page_Cache::clear_cache_by_flag( $flag );

```

You can add your own custom flags to requests too:

```
// Flag all single posts with a tag called my-special-tag:
if ( is_single() && has_tag( 'my-special-tag' ) ) {
    Redis_Page_Cache::flag( 'my-special-tag' );
}

// And whenever you need to:
Redis_Page_Cache::clear_cache_by_flag( 'my-special-tag' );

```

Note that all the clear cache methods expire (but don't delete) cache by default. If you're running in an environment where background cache regeneration is available, an expired flag will cause that background regeneration while serving a stale copy to the visitor. If this is not the desired behavior, you can use the optional $expire argument in the clear cache methods (set to false) to force delete a flag/URL.

Support
-------

[](#support)

If you need help installing and configuring this plugin, feel free to reach out to us via e-mail: .

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 74.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Total

10

Last Release

3324d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0ab3f9b98b8874849b833ccc3b0dd415d8b116654b319d17e687c218e9021e87?d=identicon)[balintsera](/maintainers/balintsera)

---

Top Contributors

[![balintsera](https://avatars.githubusercontent.com/u/8377085?v=4)](https://github.com/balintsera "balintsera (53 commits)")[![soulseekah](https://avatars.githubusercontent.com/u/685880?v=4)](https://github.com/soulseekah "soulseekah (10 commits)")[![pj-dave](https://avatars.githubusercontent.com/u/16899510?v=4)](https://github.com/pj-dave "pj-dave (7 commits)")[![bookt-jacob](https://avatars.githubusercontent.com/u/2651855?v=4)](https://github.com/bookt-jacob "bookt-jacob (1 commits)")

### Embed Badge

![Health badge](/badges/evista-pj-page-cache-red/health.svg)

```
[![Health](https://phpackages.com/badges/evista-pj-page-cache-red/health.svg)](https://phpackages.com/packages/evista-pj-page-cache-red)
```

###  Alternatives

[cheprasov/php-redis-lock

RedisLock for PHP is a synchronization mechanism for enforcing limits on access to a resource in an environment where there are many threads of execution. A lock is designed to enforce a mutual exclusion concurrency control policy.

108435.1k1](/packages/cheprasov-php-redis-lock)[altis/cms

CMS Module for Altis

46216.6k2](/packages/altis-cms)[ronilaukkarinen/dudestack

A modern WordPress stack

1131.2k](/packages/ronilaukkarinen-dudestack)[cheprasov/php-parallel

The class allows you to run multiple operations parallel in different processes and send results to the main process. Useful if you need to run multiple independent operations simultaneously, instead of sequential execution, or if you run several independent queries, for example, queries to different data bases

1712.5k5](/packages/cheprasov-php-parallel)[justcoded/wordpress-theme-framework

Lightweight theme framework base with Model-View concept for developers who want to better organize their own custom themes.

264.1k2](/packages/justcoded-wordpress-theme-framework)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
