11# Adapter Bundle
22[ ![ Build Status] ( https://travis-ci.org/php-cache/adapter-bundle.png?branch=master )] ( https://travis-ci.org/php-cache/adapter-bundle )
33
4- This bundle helps you configurate and register PSR-6 cache services. The bundle uses Doctrine as cache implementation
5- with help from [ DoctrineAdapter] to make it PSR-6 compliant.
4+ This bundle helps you configurate and register PSR-6 cache services.
65
76### To Install
87
@@ -25,51 +24,32 @@ $bundles(
2524### Configuration
2625
2726``` yaml
28- cache_adapter_doctrine :
27+ cache_adapter :
2928 providers :
3029 acme_memcached :
31- type : memcached
32- persistent : true # Boolean or persistent_id
33- namespace : mc
34- hosts :
35- - { host: localhost, port: 11211 }
36- acme_redis :
37- type : redis
38- hosts :
39- main :
40- host : 127.0.0.1
41- port : 6379
42- acme_file_system_cache :
43- type : file_system
44- extension : ' .fsc'
45- directory : ' %kernel.root_dir%/var/storage/fs_cache/'
46- acme_php_file_cache :
47- type : php_file
48- extension : ' .cache'
49- directory : ' %kernel.root_dir%/var/storage/'
50- acme_array_cache :
51- type : array
52- acme_apc_cache :
53- type : apc
54- namespace : my_ns
30+ factory : cache.factory.memcached
31+ options :
32+ persistent : true # Boolean or persistent_id
33+ namespace : mc
34+ hosts :
35+ - { host: localhost, port: 11211 }
5536` ` `
5637
5738### Usage
5839
59- When using a configuration like below, you will get a service with the id ` cache.provider.acme_apc_cache `.
40+ When using a configuration like below, you will get a service with the id ` cache.provider.acme_redis `.
6041` ` ` yaml
61- cache_adapter_doctrine :
42+ cache_adapter :
6243 providers:
63- acme_apc_cache:
64- type: apc
65- namespace: my_ns
44+ acme_redis:
45+ factory: cache.factory.redis
6646` ` `
6747
6848Use the new service as any PSR-6 cache.
6949
7050` ` ` php
7151/** @var CacheItemPoolInterface $cache */
72- $cache = $this->container->get('cache.provider.acme_apc_cache ');
52+ $cache = $this->container->get('cache.provider.acme_redis ');
7353// Or
7454$cache = $this->container->get('cache'); // This is either the ` default` provider, or the first provider in the config
7555
@@ -80,4 +60,3 @@ $item->expiresAfter(3600);
8060$cache->save($item);
8161```
8262
83- [ DoctrineAdapter ] : https://github.com/php-cache/doctrine-adapter
0 commit comments