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

Abandoned → [contributte/cache](/?search=contributte%2Fcache)Library[Caching](/categories/caching)

oops/cache-factory
==================

Simple cache factory extension for Nette.

3.0.0(9y ago)22.5k1BSD-3-ClausePHPPHP &gt;= 5.6.0

Since Jun 26Pushed 7y ago2 watchersCompare

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

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

Oops/CacheFactory
=================

[](#oopscachefactory)

⚠️ **THIS PACKAGE IS NO LONGER MAINTAINED.** You can use [contributte/cache](https://github.com/contributte/cache) instead.

Caching is a very common task in web development. The current practice of creating `Cache` instances in Nette is to enumerate `IStorage` as a dependency and create the `Cache` by hand, as seen [in the docs](http://doc.nette.org/en/2.3/caching#toc-storage-service). This, however, makes unit testing classes that depend on cache a pain in the you-know-what. You either need to mock the storage and go through `Cache` code to find what methods are called upon the storage, or use some [autoloading magic](http://docs.mockery.io/en/latest/cookbook/mocking_hard_dependencies.html). I don't think either way is a good one to go. I've found myself writing a simple factory like the one in this package on every project, so I made an extension out of it.

Installation and requirements
-----------------------------

[](#installation-and-requirements)

```
$ composer require oops/cache-factory
```

Oops/CacheFactory requires PHP &gt;= 5.6.

Usage
-----

[](#usage)

Register the extension in your config:

```
extensions:
	cacheFactory: Oops\CacheFactory\DI\CacheFactoryExtension
```

And replace all occurrences of direct `Cache` instantiation with call to the factory, so that this:

```
class CachedFoo
{
	private $cache;

	public function __construct(Nette\Caching\IStorage $cacheStorage)
	{
		$this->cache = new Nette\Caching\Cache($cacheStorage, 'namespace');
	}
}
```

becomes this:

```
class CachedFoo
{
	private $cache;

	public function __construct(Oops\CacheFactory\Caching\CacheFactory $cacheFactory)
	{
		$this->cache = $cacheFactory->create('namespace');
	}
}
```

The factory automatically uses the storage registered in the config. To provide backwards compatibility, you can also pass to the factory an arbitrary storage, should you need it:

```
$cacheFactory->create('namespace', new Nette\Caching\Storages\DevNullStorage());
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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 ~142 days

Total

4

Last Release

3552d ago

Major Versions

1.0.1 → 2.0.02016-08-17

2.0.0 → 3.0.02016-08-27

PHP version history (2 changes)1.0.0PHP &gt;= 5.3.0

2.0.0PHP &gt;= 5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/0fa15809b1f4544a0696a3f8e0d9719014242c0f7de639b12919eaedfd213cfe?d=identicon)[jiripudil](/maintainers/jiripudil)

---

Top Contributors

[![jiripudil](https://avatars.githubusercontent.com/u/1042159?v=4)](https://github.com/jiripudil "jiripudil (12 commits)")[![enumag](https://avatars.githubusercontent.com/u/539462?v=4)](https://github.com/enumag "enumag (3 commits)")

---

Tags

cachingnettephpnettecaching

### Embed Badge

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

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

###  Alternatives

[psr/simple-cache

Common interfaces for simple caching

8.1k727.3M2.1k](/packages/psr-simple-cache)[symfony/cache

Provides extended PSR-6, PSR-16 (and tags) implementations

4.2k348.9M2.5k](/packages/symfony-cache)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[kdyby/redis

Redis storage for Nette Framework

491.6M2](/packages/kdyby-redis)[overblog/dataloader-php

DataLoaderPhp is a generic utility to be used as part of your application's data fetching layer to provide a simplified and consistent API over various remote data sources such as databases or web services via batching and caching.

2124.2M6](/packages/overblog-dataloader-php)[spatie/blink

Cache that expires in the blink of an eye

1685.0M8](/packages/spatie-blink)

PHPackages © 2026

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