PHPackages                             soflomo/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. [CLI &amp; Console](/categories/cli)
4. /
5. soflomo/cache

ActiveLibrary[CLI &amp; Console](/categories/cli)

soflomo/cache
=============

Command line utility for cache management in Zend Framework 2

v0.1.0(12y ago)1410.9k↓33.3%5[1 PRs](https://github.com/Soflomo/Cache/pulls)BSD-3-ClausePHPPHP &gt;=5.3.3

Since May 8Pushed 9y ago3 watchersCompare

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

READMEChangelog (1)Dependencies (2)Versions (3)Used By (0)

Soflomo\\Cache
==============

[](#soflomocache)

Soflomo\\Cache is a command line utility for cache management in Zend Framework 2. It enables you to manage your Zend\\Cache instances from the commandline, including:

1. Printing a list of all available cache services
2. Get the status (total space, available space) of all services
3. Flush the complete cache instance
4. Clear the cache by expired items
5. Clear the cache by namespace
6. Clear the cache by prefix
7. Removing ZF2 application caches: the merged config and module map files

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

[](#installation)

Soflomo\\Cache works with [Composer](https://getcomposer.org). Make sure you have the composer.phar downloaded and you have a `composer.json` file at the root of your project. To install it, add the following line into your `composer.json`file:

```
"require": {
    "soflomo/cache": "~0.2"
}

```

After installation of the package, you need to enable the module by adding `Soflomo\Cache` to your `application.config.php` file.

Requirements
------------

[](#requirements)

1. Zend Framework 2: the `Zend\Cache` component
2. Zend Framework 2: the `Zend\Mvc` component

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

[](#configuration)

Soflomo\\Cache scans automatically the list of available caches from the `caches`key in the configuration. This key serves to [define your caches as service](http://framework.zend.com/manual/2.3/en/modules/zend.mvc.services.html#zend-cache-service-storagecacheabstractservicefactory). If you want to use this key, you must register the cache as abstract factory:

```
'service_manager' => array(
    'abstract_factories' => array(
        'Zend\Cache\Service\StorageCacheAbstractServiceFactory',
    ),
),
```

With Soflomo\\Cache you are not forced to use the cache abstract factory. The only prerequisite is the cache must be available as a service. You can register your own cache service using e.g. the service manager. For these self-defined caches you cannot use the `--list` and `--status --all` commands and you are required to supply the service name of the cache.

Usage
-----

[](#usage)

Typing `php public/index.php` will show you a list of all available commands in your application, including all Soflomo\\Cache commands.

### List all available caches

[](#list-all-available-caches)

```
php public/index.php cache --list
```

NB. You have to define your caches using the [abstract factory](#configuration).

### Get the cache status

[](#get-the-cache-status)

```
php public/index.php cache --status
```

If you have only one cache defined, this cache is picked. For more than one cache, you will get to choose which cache's status must be printed.

When your cache is defined without using the [abstract factory](#configuration), you must supply the cache name:

```
php public/index.php cache --status MyCacheServiceName
```

All cache statuses are listed with `--all`:

```
php public/index.php cache --status --all
```

Note with the `--all` only caches from the abstract factory are listed.

### Flush the cache

[](#flush-the-cache)

```
php public/index.php cache --flush
```

If you have only one cache defined, this cache is picked. For more than one cache, you will get to choose which cache's status must be printed.

When your cache is defined without using the [abstract factory](#configuration), you must supply the cache name:

```
php public/index.php cache --flush MyCacheServiceName
```

All clearing operations, including `--flush` will require confirmation via the prompt. Using the command non-interactively, you can use the `--force` or `-f`flag:

```
php public/index.php cache --flush --force
```

### Clear all expired items

[](#clear-all-expired-items)

```
php public/index.php cache --clear --expired
```

If you have only one cache defined, this cache is picked. For more than one cache, you will get to choose which cache's status must be printed.

When your cache is defined without using the [abstract factory](#configuration), you must supply the cache name:

```
php public/index.php cache --clear MyCacheServiceName --expired
```

All clearing operations, including `--clear --expired` will require confirmation via the prompt. Using the command non-interactively, you can use the `--force`or `-f` flag:

```
php public/index.php cache --clear --expired --force
```

### Clear items by namespace

[](#clear-items-by-namespace)

```
php public/index.php cache --clear --by-namespace=MyNamespace
```

If you have only one cache defined, this cache is picked. For more than one cache, you will get to choose which cache's status must be printed.

When your cache is defined without using the [abstract factory](#configuration), you must supply the cache name:

```
php public/index.php cache --clear MyCacheServiceName --by-namespace=MyNamespace
```

All clearing operations, including `--clear --by-namespace=MyNamespace` will require confirmation via the prompt. Using the command non-interactively, you can use the `--force` or `-f` flag:

```
php public/index.php cache --clear --force --by-namespace=MyNamespace
```

### Clear items by prefix

[](#clear-items-by-prefix)

```
php public/index.php cache --clear --by-prefix=MyPrefix
```

If you have only one cache defined, this cache is picked. For more than one cache, you will get to choose which cache's status must be printed.

When your cache is defined without using the [abstract factory](#configuration), you must supply the cache name:

```
php public/index.php cache --clear MyCacheServiceName --by-prefix=MyPrefix
```

All clearing operations, including `--clear --by-prefix=MyPrefix` will require confirmation via the prompt. Using the command non-interactively, you can use the `--force` or `-f` flag:

```
php public/index.php cache --clear --force --by-prefix=MyPrefix
```

### Clear the ZF2 application's config cache

[](#clear-the-zf2-applications-config-cache)

```
php public/index.php cache --clear-config
```

### Clear the ZF2 application's module map

[](#clear-the-zf2-applications-module-map)

```
php public/index.php cache --module-map
```

Clearing opcode cache
---------------------

[](#clearing-opcode-cache)

At this moment, it is not possible to clear the opcode cache. The opcode caches of CLI and PHP-FPM are not shared and as such, you cannot control the cache from PHP-FPM with the CLI.

Like the Symfony [ApcBundle](https://github.com/ornicar/ApcBundle) it is required to create a file in the web directory and call that file via HTTP. Then the file itself can clear the PHP-FPM opcode cache. You can track the progress of this feature in the issue #2.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity49

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

Unknown

Total

1

Last Release

4393d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5c8ca0c8435ae4c01c201bb52f63a72a8f9ef203f61535d7daf588f6b3a7df1c?d=identicon)[juriansluiman](/maintainers/juriansluiman)

---

Top Contributors

[![guilherme-santos](https://avatars.githubusercontent.com/u/281564?v=4)](https://github.com/guilherme-santos "guilherme-santos (4 commits)")

---

Tags

clicachezf2

### Embed Badge

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

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

###  Alternatives

[stroker/cache

Provides a full page cache solution for Laminas

6444.7k](/packages/stroker-cache)[b13/warmup

This extension adds a CLI script to warmup the caches.

12120.6k](/packages/b13-warmup)[zenddevops/client

ZF2 CLI tool to access Zend Server Web API

225.1k](/packages/zenddevops-client)[radnan/rdn-console

Zend Framework 2 Symfony Console module

1021.9k3](/packages/radnan-rdn-console)

PHPackages © 2026

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