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 1mo 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 14% 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

[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[wp-media/wp-rocket

Performance optimization plugin for WordPress

7431.3M3](/packages/wp-media-wp-rocket)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[colinmollenhour/php-redis-session-abstract

A Redis-based session handler with optimistic locking

6325.6M14](/packages/colinmollenhour-php-redis-session-abstract)[cheprasov/php-redis-client

Php client for Redis. It is a fast, fully-functional and user-friendly client for Redis, optimized for performance. RedisClient supports the latest versions of Redis starting from 2.6 to 6.0

1281.2M21](/packages/cheprasov-php-redis-client)[amphp/redis

Efficient asynchronous communication with Redis servers, enabling scalable and responsive data storage and retrieval.

165634.7k44](/packages/amphp-redis)

PHPackages © 2026

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