PHPackages                             sedpro/cachedecorator - 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. sedpro/cachedecorator

ActiveZf2-module[Caching](/categories/caching)

sedpro/cachedecorator
=====================

Simple cache decorator module for zf2 projects

09PHP

Since Dec 11Pushed 10y ago1 watchersCompare

[ Source](https://github.com/sedpro/cachedecorator)[ Packagist](https://packagist.org/packages/sedpro/cachedecorator)[ RSS](/packages/sedpro-cachedecorator/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

CacheDecorator
==============

[](#cachedecorator)

Version 0.1

This module allows you simple caching of your service methods.

The main idea was to create a caching module, which can be connected to a project without changing code. All you need to do is ajust your config.

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

[](#installation)

For the installation uses composer [composer](http://getcomposer.org "composer - package manager").

```
php composer.phar require  sedpro/cachedecorator:dev-master
```

Add this project in your composer.json:

"require": { "sedpro/cachedecorator": "dev-master" }

Post Installation
-----------------

[](#post-installation)

Configuration:

- Add the module of `config/application.config.php` under the array `modules`, insert `Cachedecorator`
- Remove services, you want to cache, from getServiceConfig function in file `Module.php`
- In your `config/autoload/global.php` file add two values:

    ```
      'caches' => [
          \Cachedecorator\Module::STORAGE => [
              'adapter' => [
                  'name' => 'memcached',
              ],
              'options' => [
                  'ttl' => 3600,
                  'servers' => [
                      'node0' => [
                          'host' => '127.0.0.1',
                          'port' => 11211,
                      ],
                  ],
                  'namespace' => 'some_ns:',
              ],
          ],
      ],
      \Cachedecorator\Module::METHODS => [
          'Application\Service\Example' => [
              'getItems',
          ],
      ],
    ```

'caches' contains all caches you use in project. They will be instantiate in abstact factory `Zend\Cache\Service\StorageCacheAbstractServiceFactory` which is called in `vendor/sedpro/cachedecorator/config/module.config.php`. If you are already using this factory, there will be no conflict.

'\\Cachedecorator\\Module::STORAGE' is cache storage adapter, used to store the output of your services.

'\\Cachedecorator\\Module::METHODS' is list of services you want to cache. Cached will be only listed functions.

Example
=======

[](#example)

If you use the configuration, showed above, method getItems of class Application\\Service\\Example will be cached. You can use it as usual:

```
  $exampleService = $this->getServiceLocator()->get('Application\Service\Example');
  $items = $exampleService->getItems(); // cached
  $values = $exampleService->getValues(); // not cached
```

###  Health Score

20

—

LowBetter than 12% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/sedpro-cachedecorator/health.svg)

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

###  Alternatives

[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

21114.2k](/packages/iazaran-smart-cache)[phpfastcache/phpssdb

PHP SSDB Driver for phpFastCache

14736.9k1](/packages/phpfastcache-phpssdb)[rapidwebltd/rw-file-cache

RW File Cache is a PHP File-based Caching Library. Its syntax is designed to closely resemble the PHP memcache extension.

15196.8k7](/packages/rapidwebltd-rw-file-cache)[yuzuru-s/redis-recommend

Wrapping Redis's sorted set APIs for specializing recommending operations.

392.9k](/packages/yuzuru-s-redis-recommend)[ichhabrecht/intcache

Turn uncachable page objects into cacheable links

193.9k](/packages/ichhabrecht-intcache)

PHPackages © 2026

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