From 0878ced52cc2280746e2df685b383eac25621d0c Mon Sep 17 00:00:00 2001 From: Jean-Francois Dion Date: Mon, 24 Oct 2016 14:45:06 -0400 Subject: [PATCH 1/3] Added support for APCu Cache driver. Available in Doctrine\Cache project since v1.6 --- composer.json | 3 +++ .../Provider/DoctrineOrm/DoctrineOrmServiceProvider.php | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/composer.json b/composer.json index 31c1f89..400a3b5 100644 --- a/composer.json +++ b/composer.json @@ -21,6 +21,9 @@ "pimple/pimple": ">=2.1,<4", "doctrine/orm": "~2.3" }, + "require-dev": { + "phpunit/phpunit" : "~4.0" + }, "autoload": { "psr-4": { "Dflydev\\Provider\\DoctrineOrm\\": "src/Dflydev/Provider/DoctrineOrm" diff --git a/src/Dflydev/Provider/DoctrineOrm/DoctrineOrmServiceProvider.php b/src/Dflydev/Provider/DoctrineOrm/DoctrineOrmServiceProvider.php index fe28d94..479aa6d 100755 --- a/src/Dflydev/Provider/DoctrineOrm/DoctrineOrmServiceProvider.php +++ b/src/Dflydev/Provider/DoctrineOrm/DoctrineOrmServiceProvider.php @@ -12,6 +12,7 @@ namespace Dflydev\Provider\DoctrineOrm; use Doctrine\Common\Cache\ApcCache; +use Doctrine\Common\Cache\ApcuCache; use Doctrine\Common\Cache\ArrayCache; use Doctrine\Common\Cache\CacheProvider; use Doctrine\Common\Cache\FilesystemCache; @@ -321,6 +322,10 @@ public function register(Container $container) return new ApcCache; }); + $container['orm.cache.factory.apcu'] = $container->protect(function () { + return new ApcuCache; + }); + $container['orm.cache.factory.xcache'] = $container->protect(function () { return new XcacheCache; }); From e27ac3223331bee92da6764287b4706628f868bd Mon Sep 17 00:00:00 2001 From: Jean-Francois Dion Date: Tue, 25 Oct 2016 08:11:27 -0400 Subject: [PATCH 2/3] Added types of cache drivers to README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 0dd5437..74ab33a 100644 --- a/README.md +++ b/README.md @@ -234,6 +234,8 @@ Configuration `Doctrine\ORM\Mapping\EntityListenerResolver`. * **orm.default_cache**: String or array describing default cache implementation. + * Available cache implementations, one of `array`, `filesystem`, `apc`, `apcu`, `memcache`, `memcached`, `redis`, + `xcache` or `couchbase` * **orm.add_mapping_driver**: Function providing the ability to add a mapping driver to an Entity Manager. From 808662a5859e6cc2fcae5dc4f7af6c106df8782f Mon Sep 17 00:00:00 2001 From: Jean-Francois Dion Date: Tue, 25 Oct 2016 08:33:33 -0400 Subject: [PATCH 3/3] Added cache types to README.MD --- .gitignore | 1 + README.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 987e2a2..5d13a24 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ composer.lock vendor +.idea diff --git a/README.md b/README.md index 74ab33a..7cfaf62 100644 --- a/README.md +++ b/README.md @@ -235,7 +235,7 @@ Configuration * **orm.default_cache**: String or array describing default cache implementation. * Available cache implementations, one of `array`, `filesystem`, `apc`, `apcu`, `memcache`, `memcached`, `redis`, - `xcache` or `couchbase` + `xcache` or `couchbase`. Some implementations may require more configuration than others. * **orm.add_mapping_driver**: Function providing the ability to add a mapping driver to an Entity Manager.