PHPackages                             dgreda/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. [Caching](/categories/caching)
4. /
5. dgreda/cache-factory

AbandonedLibrary[Caching](/categories/caching)

dgreda/cache-factory
====================

Simple factory for php-cache/cache library (PSR-6 Cache implementation)

v0.1.1(10y ago)0293[1 issues](https://github.com/dgreda/cache-factory/issues)MITPHP

Since Mar 22Pushed 7y ago1 watchersCompare

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

READMEChangelogDependencies (4)Versions (4)Used By (0)

Cache Factory
=============

[](#cache-factory)

[![Author](https://camo.githubusercontent.com/db78a7e04b0e38fea68bb8ab0f0b2548cf5ff4e60c3a330c87977ceea06dd6e4/687474703a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d406467726564612d626c75652e7376673f7374796c653d666c61742d737175617265)](https://www.linkedin.com/in/damiangreda)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Build Status](https://camo.githubusercontent.com/54087432811bb154f1dfcbe07aff09e5363e9c215b8571e2a50f9b07f8208a51/68747470733a2f2f7472617669732d63692e6f72672f6467726564612f63616368652d666163746f72792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dgreda/cache-factory)[![codecov](https://camo.githubusercontent.com/59a5a5b106993e0d942847d95b403848ef8621f0b885c19ca8f6882cd3486b03/68747470733a2f2f636f6465636f762e696f2f67682f6467726564612f63616368652d666163746f72792f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/dgreda/cache-factory)[![SensioLabsInsight](https://camo.githubusercontent.com/f9ac35167594dd7f915c04e9e8c20957a5e85b812cc7aa31dae2c873b3ed342f/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f38333361663761362d376565652d343731622d613561382d6565333836313131336439662f6d696e692e706e67)](https://insight.sensiolabs.com/projects/833af7a6-7eee-471b-a5a8-ee3861113d9f)

Description
===========

[](#description)

Simple Factory for php-cache/cache library (PSR-6 Cache implementation).

Goal
====

[](#goal)

To offer a simple way of creating different cache pool adapters based on simplified configurations.

Usage
=====

[](#usage)

The factory creates and returns a PSR-6 compatible cache pool based on small and tidy configuration provided as either PHP array or via YAML configuration file.

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

[](#installation)

Library is available on Packagist, so you can simply run:

```
composer require "dgreda/cache-factory":"v0.1.*"

```

Adapters
--------

[](#adapters)

Currently factory supports the following adapters:

- Filesystem
- Memcached
- Predis

The goal is to implement all the adapters implemented by

Examples
--------

[](#examples)

There are some examples of usage under the "examples" directory.

Nevertheless, to give you a quick explanation and idea how it works, let's assume that you want to quickly obtain a Memcached cache pool implementation. You prepare the following YAML file and save it as 'cache.yml'

```
Cache:
  adapter:
    memcached:
      type: Memcached
      servers:
        memcached1: { host: localhost, port: 11211 }

```

Then in your PHP code you instantiate the factory and provide the config file to it, to easily make an instance of desired cache pool defined in the YAML:

```
use Cache\Factory\Factory;

...

$cachePoolFactory = new Factory();

$cachePoolFactory->setConfigFile('cache.yml');

$cachePool = $cachePoolFactory->make('memcached');

```

Now you have the PSR-6 compatible instance of cache pool using the desired cache adapter!

Your YAML file can contain several adapters defined and you can easily get a new instance of desired/needed cache pool by simply passing the name of the adapter as a parameter to the 'make' method of the factory.

Credits
=======

[](#credits)

Inspiration to create this library came from the flysystem-factory where I am also a contributor:

The flysystem-factory library development was initiated by

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

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

Total

2

Last Release

3700d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/396c3101aa3aa964f59d7a33426d880edd7981092cca82de19a353d17113dafe?d=identicon)[dgreda](/maintainers/dgreda)

---

Top Contributors

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

---

Tags

factoryrediscachepsr-6memcached

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[tedivm/stash

The place to keep your cache.

9824.8M124](/packages/tedivm-stash)[tedivm/stash-bundle

Incorporates the Stash caching library into Symfony.

841.4M16](/packages/tedivm-stash-bundle)[cache/redis-adapter

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

523.9M27](/packages/cache-redis-adapter)[cache/predis-adapter

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

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

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

161.9M14](/packages/cache-memcached-adapter)[aplus/cache

Aplus Framework Cache Library

161.6M4](/packages/aplus-cache)

PHPackages © 2026

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