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

ActiveLibrary[Caching](/categories/caching)

maartengdev/cache-drivers
=========================

Cache all data using different drivers

1.2(9y ago)043MITPHP

Since Sep 8Pushed 9y ago1 watchersCompare

[ Source](https://github.com/MaartenGDev/CacheDrivers)[ Packagist](https://packagist.org/packages/maartengdev/cache-drivers)[ RSS](/packages/maartengdev-cache-drivers/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

[![Build Status](https://camo.githubusercontent.com/ecae7b904cf5e4b8523d82c9d13da1773ed7b6d4f22c706ffcda0b25e3bd45d6/68747470733a2f2f7472617669732d63692e6f72672f4d61617274656e474465762f4361636865447269766572732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/MaartenGDev/CacheDrivers)[![Coverage Status](https://camo.githubusercontent.com/e18dc6f25c3001b4831c9640afc2a602702ba9957313daea85cb7ab0025d823d/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f4d61617274656e474465762f4361636865447269766572732f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/MaartenGDev/CacheDrivers?branch=master)[![Total Downloads](https://camo.githubusercontent.com/a8995dc46d94d8e9b8575da06dd0760e2050d6d526832d47d144d0bc55ba8f64/68747470733a2f2f706f7365722e707567782e6f72672f6d61617274656e676465762f63616368652d647269766572732f646f776e6c6f616473)](https://packagist.org/packages/maartengdev/cache-drivers)[![Latest Stable Version](https://camo.githubusercontent.com/b9d5037b84535f8465b35ee7f64f600a4f5f6e5f27d823e9ed955ea5c93bfc72/68747470733a2f2f706f7365722e707567782e6f72672f6d61617274656e676465762f63616368652d647269766572732f762f737461626c65)](https://packagist.org/packages/maartengdev/cache-drivers)[![License](https://camo.githubusercontent.com/a7a6d8b675743d8c1dc2daf0614953c46c1245e821cb3c4bd35060f339625ed3/68747470733a2f2f706f7365722e707567782e6f72672f6d61617274656e676465762f63616368652d647269766572732f6c6963656e7365)](https://packagist.org/packages/maartengdev/cache-drivers)

Cache Drivers
=============

[](#cache-drivers)

An easy to use php caching library.

Usage
-----

[](#usage)

##### Basic Usage

[](#basic-usage)

```
$dir = $_SERVER['DOCUMENT_ROOT'] .'/cache/';
$expireTime = 30;

$driver = new LocalDriver($dir);
$cache = new Cache($driver, $expireTime);

$key = 'HelloWorld';

// Check if cache entry exists
$cacheHasKey = $cache->has($key);

// Create new cache entry
$cache->store($key, 'Hello World Cache Drivers');

// Get cache entry
$cacheEntry = $cache->get($key);
// result: "Hello World Cache Drivers"
```

##### Check for cache entry with closure

[](#check-for-cache-entry-with-closure)

```
$dir = $_SERVER['DOCUMENT_ROOT'] .'/cache/';
$drive = new LocalDriver($dir);
$cache = new Cache($drive,30);

function myFunction(Cache $cache){
    $key = 'HelloWorld';

    $cacheEntry = $cache->has($key, function ($cache) use ($key) {
        return $cache->get($key);
    });

    if ($cacheEntry) {
        return $cacheEntry;
    }

    $cache->store($key, 'Hello World!');

    return $cache->get($key);
}
myFunction($cache);

// result: "Hello World!"
```

Licence
-------

[](#licence)

MIT

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity65

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

Total

3

Last Release

3492d ago

### Community

---

Top Contributors

[![MaartenGDev](https://avatars.githubusercontent.com/u/18325396?v=4)](https://github.com/MaartenGDev "MaartenGDev (36 commits)")

### Embed Badge

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

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

###  Alternatives

[predis/predis

A flexible and feature-complete Redis/Valkey client for PHP.

7.8k305.7M2.4k](/packages/predis-predis)[snc/redis-bundle

A Redis bundle for Symfony

1.0k39.4M67](/packages/snc-redis-bundle)[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)

PHPackages © 2026

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