PHPackages                             themeplate/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. themeplate/cache

ActiveLibrary[Caching](/categories/caching)

themeplate/cache
================

Convenient fragment caching methods

v2.10.0(1y ago)1177GPL-3.0-onlyPHPPHP ^7.4|^8.2

Since Apr 6Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ThemePlate/Cache)[ Packagist](https://packagist.org/packages/themeplate/cache)[ RSS](/packages/themeplate-cache/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelogDependencies (2)Versions (19)Used By (0)

ThemePlate Cache
================

[](#themeplate-cache)

Usage
-----

[](#usage)

```
use ThemePlate\Cache;

Cache::remember( 'unique_key', function() {
    return expensive_task();
}, MINUTE_IN_SECONDS );

Cache::forget( 'unique_key' );

Cache::file( 'special_key', 'path_to_file' );

$processor = Cache::processor();

$processor->report( function( $output ) {
    error_log( print_r( $output, true ) );
} );

function hourly_moment() {
    return 'to remember ' . time();
}

Cache::remember( 'unique_key', 'hourly_moment', HOUR_IN_SECONDS );
```

### Force refresh value/s

[](#force-refresh-values)

`/?tcs_refresh=`

`/?tcs_refresh[]=&tcs_refresh[]=`

> *works only when logged-in*

### Cache::remember( $key, $callback, $expiration )

[](#cacheremember-key-callback-expiration-)

Retrieve content from the cache or, if it doesn't exist, execute $callback and its result is returned then saved

- **$key** *(string)(Required)* Unique cache key to use
- **$callback** *(callable)(Required)* Function that returns data to store
- **$expiration** *(int)(Optional)* Number of seconds before entry expires. Default 0 (forever)

### Cache::forget( $key, $default )

[](#cacheforget-key-default-)

Retrieve and delete the cache

- **$key** *(string)(Required)* Unique cache key to use
- **$default** *(mixed)(Optional)* To return if cache doesn't exist. Default `null`

### Cache::file( $key, $path )

[](#cachefile-key-path-)

Like `remember` but, uses the file contents and no expiration, automatically updates if the file is modified instead

- **$key** *(string)(Required)* Unique cache key to use
- **$path** *(string)(Required)* Path of the file to read

### Cache::processor()

[](#cacheprocessor)

Support for soft-expiration, `Cache::remember`\* and `Cache::file` updates in the background

> \*Except for using anonymous function as callback (closure)

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance49

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity77

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 ~109 days

Recently: every ~96 days

Total

18

Last Release

368d ago

Major Versions

v1.x-dev → v2.0.02022-02-27

PHP version history (4 changes)v1.0.0PHP ^7.2

v1.1.1PHP ^7.2|^8.0

v2.0.0PHP ^7.4|^8.0

v2.9.0PHP ^7.4|^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/91095d431958c79a7384d515efec2686ca3cd1e1e1a5a42b680309b8e855355a?d=identicon)[kermage](/maintainers/kermage)

---

Top Contributors

[![kermage](https://avatars.githubusercontent.com/u/8350223?v=4)](https://github.com/kermage "kermage (119 commits)")

---

Tags

cachewordpresswordpress-cache

### Embed Badge

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

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

###  Alternatives

[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[wp-media/wp-rocket

Performance optimization plugin for WordPress

7431.3M3](/packages/wp-media-wp-rocket)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[colinmollenhour/php-redis-session-abstract

A Redis-based session handler with optimistic locking

6325.6M14](/packages/colinmollenhour-php-redis-session-abstract)[cheprasov/php-redis-client

Php client for Redis. It is a fast, fully-functional and user-friendly client for Redis, optimized for performance. RedisClient supports the latest versions of Redis starting from 2.6 to 6.0

1281.2M21](/packages/cheprasov-php-redis-client)[amphp/redis

Efficient asynchronous communication with Redis servers, enabling scalable and responsive data storage and retrieval.

165634.7k44](/packages/amphp-redis)

PHPackages © 2026

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