PHPackages                             rarst/fragment-cache - 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. [Caching](/categories/caching)
4. /
5. rarst/fragment-cache

ActiveWordpress-plugin[Caching](/categories/caching)

rarst/fragment-cache
====================

WordPress plugin for partial and async caching of heavy front-end elements.

1.3.1(9y ago)14115.0k↓50%92GPL-2.0+PHPPHP &gt;=5.3

Since Jun 7Pushed 8y ago14 watchersCompare

[ Source](https://github.com/Rarst/fragment-cache)[ Packagist](https://packagist.org/packages/rarst/fragment-cache)[ Docs](https://github.com/Rarst/fragment-cache)[ RSS](/packages/rarst-fragment-cache/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (6)Used By (2)

Fragment Cache
==============

[](#fragment-cache)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/20bc39e6e9135d784536d6969940561110bf8cf31ef771ec56e482442e651190/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f52617273742f667261676d656e742d63616368652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Rarst/fragment-cache/?branch=master)

Fragment Cache is a WordPress plugin for partial and async caching of heavy front-end elements. It currently supports caching navigation menus, widgets, and galleries.

Caching is built on top of transients API (with enhancements provided by TLC Transients library), provides soft expiration and transparent object cache support.

Installation
============

[](#installation)

Download plugin archive from [releases section](https://github.com/Rarst/fragment-cache/releases).

Or install in plugin directory via [Composer](https://getcomposer.org/):

```
composer create-project rarst/fragment-cache --no-dev

```

Frequently Asked Questions
==========================

[](#frequently-asked-questions)

Why fragments don't recognize logged in users / current page?
-------------------------------------------------------------

[](#why-fragments-dont-recognize-logged-in-users--current-page)

Fragment Cache implements soft expiration - when fragments expire, they are regenerated asynchronously and do not take time in front end page load. The side effect is that it is impossible to preserve context precisely and in generic way.

Fragments that must be aware of users or other context information should be excluded from caching or handled by custom implementation, that properly handles that specific context.

How to disable caching?
-----------------------

[](#how-to-disable-caching)

### Disable handler

[](#disable-handler)

Caching for the fragment type can be disabled by manipulating main plugin object:

```
global $fragment_cache;

// completely remove handler, only use before init
unset( $fragment_cache['widget'] );

// or disable handler, use after init
$fragment_cache['widget']->disable();
```

### Skip individual fragments

[](#skip-individual-fragments)

Caching for individual fragments can be disabled by using `fc_skip_cache` hook.

```
add_filter( 'fc_skip_cache', function ( $skip, $type, $name, $args, $salt ) {

	// Widget by class.
	if ( 'widget' === $type && is_a( $args['callback'][0], 'WP_Widget_Meta' ) ) {
		return true;
	}

	// Menu by theme location.
	if ( 'menu' === $type && isset( $args['theme_location'] ) && 'header' === $args['theme_location'] ) {
		return true;
	}

	// Menu by name.
	if ( 'menu' === $type && isset( $args['menu'] ) ) {

		if ( 'Menu with login' === $args['menu'] ) {
			return true;
		}

		if ( is_a( $args['menu'], 'WP_Term' ) && 'Menu with login' === $args['menu']->name ) {
			return true;
		}
	}

	// Gallery by ID of post.
	if ( 'gallery' === $type && 123 === $args['post_id'] ) {
		return true;
	}

	return $skip;
}, 10, 5 );
```

License Info
============

[](#license-info)

Fragment Cache own code is licensed under GPLv2+ and it makes use of code from:

- Composer (MIT)
- Pimple (MIT)
- TLC Transients (GPLv2+)

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community18

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~320 days

Total

5

Last Release

3445d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/689ddc4f33541ac4a001d247e560f8805d219a95e7e42a16e0d22b9409f385cb?d=identicon)[Rarst](/maintainers/Rarst)

---

Top Contributors

[![Rarst](https://avatars.githubusercontent.com/u/737584?v=4)](https://github.com/Rarst "Rarst (47 commits)")

---

Tags

cacheperformancewordpresswordpress-pluginwordpressperformancecache

### Embed Badge

![Health badge](/badges/rarst-fragment-cache/health.svg)

```
[![Health](https://phpackages.com/badges/rarst-fragment-cache/health.svg)](https://phpackages.com/packages/rarst-fragment-cache)
```

###  Alternatives

[wp-media/wp-rocket

Performance optimization plugin for WordPress

7431.3M3](/packages/wp-media-wp-rocket)[rtcamp/nginx-helper

Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also provides cloudflare edge cache purging with Cache-Tags.

23817.0k1](/packages/rtcamp-nginx-helper)

PHPackages © 2026

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