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

AbandonedArchivedLibrary[Caching](/categories/caching)

phpro/annotated-cache
=====================

This package makes it easy to configure the caching of your services with annotations.

v0.2.0(10y ago)1710.1k31MITPHPPHP ~7.0

Since Apr 13Pushed 5y ago4 watchersCompare

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

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

> ## Repository abandoned 2020-11-27
>
> [](#repository-abandoned-2020-11-27)
>
> This repository has been archived since we are not using it anymore internally. Feel free to use it AS-IS, we won't be providing any support anymore.

[![Build status](https://camo.githubusercontent.com/ec440a0316ab870eedf4708c0c4b85a4fe76baa5606ca7cdab05b05aa7473bb3/68747470733a2f2f6170692e7472617669732d63692e6f72672f706870726f2f616e6e6f74617465642d63616368652e737667)](http://travis-ci.org/phpro/annotated-cache)[![Insight](https://camo.githubusercontent.com/4223c20ddb3a14db3dec6fbbac465c7459089c48bcf059cf5ce0fc380b287b4a/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f61323730623436302d313166392d343832652d383531662d6162663337623438666563312e737667)](https://insight.sensiolabs.com/projects/a270b460-11f9-482e-851f-abf37b48fec1)[![Installs](https://camo.githubusercontent.com/40e958db0c592d98a7314d455eb2cb2e440f86d14e65c3717cb667d17634f6d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706870726f2f616e6e6f74617465642d63616368652e737667)](https://packagist.org/packages/phpro/annotated-cache/stats)[![Packagist](https://camo.githubusercontent.com/1304271335b6bd192c028908cdad81251246a298ce59e8b18115f53853e4a311/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706870726f2f616e6e6f74617465642d63616368652e737667)](https://packagist.org/packages/phpro/annotated-cache)

Cache Annotations
=================

[](#cache-annotations)

Stop worrying about caching, use annotations instead. This PHP library makes it possible to add annotations to your services and handles caching for you. You can use any [PSR-6](http://www.php-fig.org/psr/psr-6/) caching implementation as a caching back-end.

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

[](#installation)

```
composer require phpro/annotated-cache
```

We suggest using [php-cache](http://www.php-cache.com/en/latest/) to make it possible to add tags to your cache items.

Bridges
-------

[](#bridges)

- [Symfony](https://github.com/phpro/annotated-cache-bundle)

Usage
-----

[](#usage)

### Example usage:

[](#example-usage)

```
use Phpro\AnnotatedCache\Factory;

$poolManager = Factory::createPoolManager();
$poolManager->addPool('products', $psr6CachePool);

$cacheHandler = Factory::createCacheHandler($poolManager);
$proxyGenerator = Factory::createProxyGenerator($cacheHandler);

$myService = $proxyGenerator->generate(new My\Service());
```

We made it as easy as possible to get started with the cache manager. You will need 3 services:

- `PoolManager`: contains one or multiple PSR-6 cache pools.
- `CacheHandler`: contains the PoolManager and the logic for interacting with the cache pool.
- `ProxyGenerator`: wraps your service with an [Access Interceptor Value Holder](https://ocramius.github.io/ProxyManager/docs/access-interceptor-value-holder.html)

### Example Service

[](#example-service)

```
