PHPackages                             andreacardelli/pitbullcache - 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. andreacardelli/pitbullcache

ActiveLibrary[Caching](/categories/caching)

andreacardelli/pitbullcache
===========================

Php Cache System

0138PHP

Since Feb 20Pushed 6y agoCompare

[ Source](https://github.com/andreacardelli/pitbullcache)[ Packagist](https://packagist.org/packages/andreacardelli/pitbullcache)[ RSS](/packages/andreacardelli-pitbullcache/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

PitBullCache
============

[](#pitbullcache)

PitBullCache is a fast and simple PHP Cache library with the minimum functionalities needed that abstracts different cache mechanisms. It is easy to use and easy to implement with new cache mechanism (MemCache,...).

With PitBullCache you can speed up web sites by caching any type of data: variables, queries or even full HTML pages.

Currently the cache systems abstracted by PitBullCache are:

- File System: uses file system to save data in a directory containing the serialized data one file for each unique key
- Redis (Predis\\Client)
- Amazon S3 (tpyo/amazon-s3-php-class)

Implemented methods are:

- Fetch key
- Store key
- Delete key
- cleanUpExpired (useful jsut for file system)

Installation
============

[](#installation)

### Composer

[](#composer)

PitBullCache supports composer, just add the packagist dependency:

```
{
    "require": {
    	  "andreacardelli/pitbullcache": "dev-master"
    }
}
```

How to use it
=============

[](#how-to-use-it)

We can use any type of cache, here an example with "file" type for caching full HTML page, third parameters contains configuration used by each low level storage (file: directory, redis: standard config for predis\\client, S3: key and secret)

Define your cache (multiple cache for different purposes are allowed)

```
Pitbull_Cache::Register("file","Pitbull_Filesystem_Cache","/pitbullcache.cache/");
$_cache = Pitbull_Cache::Create("file");
```

define your unique key

```
$idpagecache = md5($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
```

retrieve the cached value of your key if it exists and if it is still valid otherwise you get false

```
if ($page=$_cache->fetch($idpagecache)) {
	echo $page;
	exit();
}
```

and for storing keys...

```
// caching full html $page for 1 day (86400 seconds)
$_cache->store($idpagecache,$page,86400);
```

(optional) for files sytem cleaning and S3 we added a class to be called with a batch job (cron) for other type of cache storage it just returns the number of cached active objects

```
$_cache->cleanUpExpired('array'); // or 'json' to get back number of deleted items
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1e710791615e5a412b615d3a7bc5ab23e43473727077dd4501995400c06b6279?d=identicon)[andreacardelli](/maintainers/andreacardelli)

---

Top Contributors

[![andreacardelli](https://avatars.githubusercontent.com/u/29506612?v=4)](https://github.com/andreacardelli "andreacardelli (27 commits)")

### Embed Badge

![Health badge](/badges/andreacardelli-pitbullcache/health.svg)

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

###  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)
