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

ActiveLibrary[Caching](/categories/caching)

peterujah/cache
===============

Cache - a simple php caching.

1.4(2y ago)5441MITPHPPHP ^7.0 || ^8.0

Since Dec 21Pushed 2y ago1 watchersCompare

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

READMEChangelog (3)DependenciesVersions (5)Used By (1)

cache
=====

[](#cache)

A simple php file cache. The Cache is designed to simplify the process of caching data in PHP applications. It provides various methods for configuration, data caching, retrieval, and cache management. It helps to reduce database queries, API calls, or expensive computations by storing the results in the cache.

Installation
------------

[](#installation)

Installation is super-easy via Composer:

```
composer require peterujah/cache
```

USAGES
======

[](#usages)

Initialize DBController with configuration array

```
use Peterujah\NanoBlock\Cache;
$cache = new Cache("CACHE_NAME", __DIR__ . "/temp/caches/");
```

Query database and save response for later use

```
$cache->setExpire(7200);
$user = $cache->onExpired("LIST", function () use($connConfig, $user_id){
	$conn_handler = new Peterujah\NanoBlock\DBController($connConfig);
	$conn_handler->prepare('
	      SELECT * FROM user_table
	      WHERE user_id = :fund_user_id
	      LIMIT 1
	');
	$conn_handler->bind(':fund_user_id', $user_id);
	$conn_handler->execute();
	$user = $conn_handler->getOne();
	$conn_handler->free();
	return  array(
	    "user" => $user,
	    "time" => time(),
	    "morething" => "More"
	);
});
```

Sets the cache debugging mode, the default is false

```
$cache->setDebugMode(true|false);
```

Sets the cache file extension type default is JSON

```
$cache->setExtension(Cache::PHP | Cache::JSON | Cache::TEXT);
```

Enable the cache to store secure data available only with php file extension, the default is true.

```
$cache->enableSecureAccess(true | false);
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

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

Total

4

Last Release

939d ago

Major Versions

0.1.2 → 1.32022-02-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/ce34af529a4ed50696211a2b4d330fbadd2d1738bc5d010523eb4a85cf342b17?d=identicon)[peterujah](/maintainers/peterujah)

---

Top Contributors

[![peterujah](https://avatars.githubusercontent.com/u/16369609?v=4)](https://github.com/peterujah "peterujah (25 commits)")

---

Tags

librarycachephp file cacheweb cachephp cache library

### Embed Badge

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

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

###  Alternatives

[moust/silex-cache

Cache service provider for Silex application

33138.4k1](/packages/moust-silex-cache)[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.

15191.3k7](/packages/rapidwebltd-rw-file-cache)[cache/void-adapter

A PSR-6 cache implementation using Void. This implementation supports tags

183.0M44](/packages/cache-void-adapter)[spekkionu/assetcachebuster

Prefixes asset urls with a unique hash which will allow invalidation of asset files cached by the browser.

3243.2k](/packages/spekkionu-assetcachebuster)[ihor/cachalot

Cache a lot in a proper way (APC, XCache, Memcached, Redis, Couchbase)

2528.1k](/packages/ihor-cachalot)

PHPackages © 2026

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