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)1182GPL-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 1w 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

39

—

LowBetter than 84% of packages

Maintenance42

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity78

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

459d 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://avatars.githubusercontent.com/u/8350223?v=4)[Gene Alyson Fortunado Torcende](/maintainers/kermage)[@kermage](https://github.com/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

[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

21114.2k](/packages/iazaran-smart-cache)[phpfastcache/phpssdb

PHP SSDB Driver for phpFastCache

14736.9k1](/packages/phpfastcache-phpssdb)[rapidwebltd/rw-file-cache

RW File Cache is a PHP File-based Caching Library. Its syntax is designed to closely resemble the PHP memcache extension.

15196.8k7](/packages/rapidwebltd-rw-file-cache)[yuzuru-s/redis-recommend

Wrapping Redis's sorted set APIs for specializing recommending operations.

392.9k](/packages/yuzuru-s-redis-recommend)[ichhabrecht/intcache

Turn uncachable page objects into cacheable links

193.9k](/packages/ichhabrecht-intcache)

PHPackages © 2026

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