PHPackages                             pcelta/doctrine-cache-factory - 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. [Database &amp; ORM](/categories/database)
4. /
5. pcelta/doctrine-cache-factory

ActiveLibrary[Database &amp; ORM](/categories/database)

pcelta/doctrine-cache-factory
=============================

A Doctrine Cache Factory

0.1.0(9y ago)818.2k↓66.7%1MITPHPPHP &gt;=5.4.0

Since May 26Pushed 8y agoCompare

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

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

Cache Service Provider
======================

[](#cache-service-provider)

[![Build Status](https://camo.githubusercontent.com/1ab2aa114dcef17c05a082ee2ec903e155f6189a96ebc29beb3323c1c5d33282/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7063656c74612f646f637472696e652d63616368652d666163746f72792f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/pcelta/doctrine-cache-factory)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/da5d3c6f578ac584eb9f625b24d766f623d076b6c6ae7b0d796be26af04a6b95/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7063656c74612f646f637472696e652d63616368652d666163746f72792f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/pcelta/doctrine-cache-factory/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/bf03fbc6b54b10b6398d532cdc58514ee4de76ca6f3527296595b2587732a242/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f7063656c74612f646f637472696e652d63616368652d666163746f72792f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/pcelta/doctrine-cache-factory/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/fd18408203148087af8ee8154481f9756f3fa8053ca5334f904c98b363fa7f27/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7063656c74612f646f637472696e652d63616368652d666163746f72792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pcelta/doctrine-cache-factory)[![Total Downloads](https://camo.githubusercontent.com/057b06d1165ea8e90c1bea5cdd3bd68bf9decd3feeef8c40e6b7ad10baeac3ff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7063656c74612f646f637472696e652d63616368652d666163746f72792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pcelta/doctrine-cache-factory)[![License](https://camo.githubusercontent.com/7442e3bd81976f3fea6ad4c204675006b4cf00216ce60a86e4854b9b6829e230/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7063656c74612f646f637472696e652d63616368652d666163746f72792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pcelta/doctrine-cache-factory)

doctrine-cache-factory
======================

[](#doctrine-cache-factory)

Doctrine Cache Factory it's better way to uncouple your application of the cache adapters. Changing just the configuration the factory will load a different client.

Instalation
-----------

[](#instalation)

```
{
    "require": {
        "pcelta/doctrine-cache-factory": "dev-master"
    }
}
```

Adapters Availables
-------------------

[](#adapters-availables)

- Custom
- Array
- Memcache
- Memcached
- Redis

Write your own adapter
----------------------

[](#write-your-own-adapter)

Use the adapter namespace to specify the location of your adapter.

```
use Pcelta\Doctrine\Cache\Factory;

$factory = new Factory();
$cacheSettings [
    'adapter'           => 'Memcache',
    'adapter_namespace' => '\Doctrine\Common\Cache\%sCache',
    'host'              => '127.0.0.1',
    'port'              => 11211,
];

$cacheProvider = $factory->create($cacheSettings);
```

How to use Array
----------------

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

```
use Pcelta\Doctrine\Cache\Factory;

$factory = new Factory();
$cacheSettings [
    'adapter'       => 'Array',
];

$cacheProvider = $factory->create($cacheSettings);
```

How to use Memcache
-------------------

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

Install php5-memcache

```
sudo apt-get install php5-memcache

```

```
use Pcelta\Doctrine\Cache\Factory;

$factory = new Factory();
$cacheSettings [
    'adapter_name' => 'Memcache',
    'host'         => '127.0.0.1',
    'port'         => 11211,
];

$cacheProvider = $factory->create($cacheSettings);
```

How to use Memcached
--------------------

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

Install php5-memcached

```
sudo apt-get install php5-memcached

```

```
use Pcelta\Doctrine\Cache\Factory;

$factory = new Factory();
$cacheSettings [
    'adapter_name' => 'Memcached',
    'host'         => '127.0.0.1',
    'port'         => 11211,
];

$cacheProvider = $factory->create($cacheSettings);
```

How to use Redis
----------------

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

install [PHPRedis](https://github.com/phpredis/phpredis)

```
git clone git@github.com:phpredis/phpredis.git
cd phpredis
phpize
./configure
make && make install

```

```
use Pcelta\Doctrine\Cache\Factory;

$factory = new Factory();
$cacheSettings [
    'adapter_name' => 'Redis',
    'host'         => '127.0.0.1',
    'port'         => 11211,
];

$cacheProvider = $factory->create($cacheSettings);
```

General Usage
-------------

[](#general-usage)

```
use Pcelta\Doctrine\Cache\Factory;

$factory = new Factory();
$cacheSettings [
    'adapter_name' => 'Memcache',
    'host'         => '127.0.0.1',
    'port'         => 11211,
];

$cacheProvider = $factory->create($cacheSettings);

$cacheProvider->save('your-key', 'your-data');
$data = $cacheProvider->fetch('your-key');

echo $data; // your-data
```

Comparing Doctrine Cache Factory with Doctrine Cache Pure
---------------------------------------------------------

[](#comparing-doctrine-cache-factory-with-doctrine-cache-pure)

[Doctrine Cache](http://doctrine-orm.readthedocs.org/en/latest/reference/caching.html)
======================================================================================

[](#doctrine-cache)

```
$memcache = new Memcache(); // it's bad to uncouple
$memcache->connect('memcache_host', 11211);

$cacheDriver = new \Doctrine\Common\Cache\MemcacheCache();
$cacheDriver->setMemcache($memcache);
$cacheDriver->save('cache_id', 'my_data');
```

[Doctrine Cache Factory](https://github.com/pcelta/doctrine-cache-factory)
==========================================================================

[](#doctrine-cache-factory-1)

```
$factory = new \Pcelta\Doctrine\Cache\Factory();
$cacheSettings [
    'adapter_name' => 'Memcache', // it's much better
    'host'         => '127.0.0.1',
    'port'         => 11211,
];

$cacheProvider = $factory->create($cacheSettings);
$cacheProvider->save('cache_id', 'your-data');
```

Road Map
--------

[](#road-map)

- Couchbase

License
-------

[](#license)

MIT License

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Total

3

Last Release

3611d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

doctrinecachepcelta

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pcelta-doctrine-cache-factory/health.svg)

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

###  Alternatives

[cache/doctrine-adapter

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

151.0M21](/packages/cache-doctrine-adapter)[cache/psr-6-doctrine-bridge

PSR-6 Doctrine bridge

151.0M4](/packages/cache-psr-6-doctrine-bridge)[kdyby/doctrine-cache

Doctrine Cache bridge for Nette Framework

101.3M19](/packages/kdyby-doctrine-cache)[cache/cache-bundle

Symfony 2 bundle providing integration between PSR-6 compliant cache services and the framework. It supports cache for sessions, routing and Doctrine

43437.0k](/packages/cache-cache-bundle)

PHPackages © 2026

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