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

ActiveLibrary[Caching](/categories/caching)

quick/cache
===========

This is a cache system that uses Redis for rapid caching.

v1.0.1(13y ago)122.7k1MITPHPPHP &gt;=5.3.0

Since Sep 21Pushed 13y ago2 watchersCompare

[ Source](https://github.com/jerel/quick-cache)[ Packagist](https://packagist.org/packages/quick/cache)[ Docs](http://github.com/jerel/quick-cache)[ RSS](/packages/quick-cache/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Quick Cache
===========

[](#quick-cache)

A quick and easy to use PSR-2 driver based caching library that will cache simple key/value pairs or call methods and cache their results.

[![Build Status](https://camo.githubusercontent.com/8990cc4e5805f8a135d9cc0a763791a5266c88a304a4d4a99b679df06033432f/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f6a6572656c2f717569636b2d63616368652e706e67)](http://travis-ci.org/jerel/quick-cache)

### Includes Drivers For

[](#includes-drivers-for)

- Redis (using the fantastic predis library)
- APC (requires APC installation / extension) \*
- Filesystem

\* APC driver doesn't support clearing class/method caches manually via `$cache->clear()`.

### Author

[](#author)

- [Jerel Unruh](http://unruhdesigns.com/)

### License

[](#license)

MIT License

Usage
-----

[](#usage)

First install it via composer by placing this in a composer.json file

```
{
	"require": {
	    "quick/cache": "v1.0.0"
	}
}

```

and running `composer.phar install`

Now you can use it in your code by calling the class:

```
$cache = new Quick\Cache;

$cache->set('name', 'Jerel Unruh', $ttl = 3600); /* will expire in 3600 seconds */

$name = $cache->get('name');

$cache->forget('name');

```

Let it call your methods for you and handle the results:

```
// you can pass any config items in an array
$cache = new Quick\Cache(array('driver' => 'redis'));

// pass any arguments as an array
$cache->method($this->UserModel, 'getUsersByGroup', array('admin', 'desc'), 3600);

$cache->method('Project\Model\UserModel', 'getUsersByGroup');

// clear all the data cached for this class
$cache->clear('Project\Model\UserModel');

// or just this class + method
$cache->clear('Project\Model\UserModel', 'getUsersByGroup');

```

Flush all cached items for this driver. Don't use this in production as it's expensive. Use it when taking an app from staging to live or etc.

```
$cache = new Quick\Cache;

$cache->flush();

```

Configuration
-------------

[](#configuration)

All configuration details can be set in the config files in vendor/quick/cache/config. There is also a config class that allows you to set details programmatically. The only thing that cannot be changed with the config class is the driver. It must be set in the global config file or when instantiating the class;

```
$cache = new Quick\Cache(array('driver' => 'file'));

$config = $cache->config_instance();

$config->set('cache_path', 'project/cache/');

```

At the same time we can run another instance with different configurations

```
$redis_cache = new Quick\Cache(array('driver' => 'redis'));

$redis_config = $redis_cache->config_instance();

$redis_config->set_many(array(
	'redis_connection' => array(
		'host'     => '127.0.0.1',
		'port'     => 6379,
		),
	'redis_prefix' => 'cache',
));

// if you set the connection details manually you must refresh the connection
$redis_cache->connect();

// Create an APC driver instance
$apc_cache = new Quick\Cache(array('driver' => 'apc'));

$apc_cache->set('name', 'Jerel Unruh', 3600);

```

Other methods

```
$cache_path = $config->get('cache_path');

$config_items = $config->get_all();

$config->load('custom_driver');

```

Testing
-------

[](#testing)

Quick Cache is unit tested using phpUnit. I use Guard to run my tests while I work, if you have it installed you can test like this:

```
cd ./vendor/quick/cache
guard

```

If not you can run them via phpUnit

```
cd ./vendor/quick/cache
phpunit

```

Do not run these tests on a production environment! It will *FLUSH* your database!

Errors
------

[](#errors)

If Quick Cache encounters a serious error that it needs to tell you about (such as unwriteable directories) it will throw a `QuickCacheException`

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.9% 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 ~5 days

Total

2

Last Release

4982d ago

### Community

Maintainers

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

---

Top Contributors

[![jerel](https://avatars.githubusercontent.com/u/322706?v=4)](https://github.com/jerel "jerel (16 commits)")[![trea](https://avatars.githubusercontent.com/u/1181448?v=4)](https://github.com/trea "trea (2 commits)")

---

Tags

rediscachenosqlpredis

### Embed Badge

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

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

###  Alternatives

[predis/predis

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

7.8k305.7M2.4k](/packages/predis-predis)[predis/predis-async

Asynchronous version of Predis

366348.4k](/packages/predis-predis-async)[jamescauwelier/psredis

Sentinel client for the popular php redis client

77392.9k5](/packages/jamescauwelier-psredis)[cache/predis-adapter

A PSR-6 cache implementation using Redis (Predis). This implementation supports tags

272.6M13](/packages/cache-predis-adapter)[contributte/redis

Redis client integration into Nette framework

181.6M2](/packages/contributte-redis)[maykonn/codeigniter-predis

The CodeIgniter Redis package

129.3k](/packages/maykonn-codeigniter-predis)

PHPackages © 2026

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