From 9200e21dee65e6c3bcda0e0643dc120bc224de72 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Tue, 19 Jan 2016 20:31:36 +0100 Subject: [PATCH] Updated to the lastes version of tagging and adapter common --- README.md | 25 +++++++++++++++++-------- composer.json | 8 ++++---- src/ApcCachePool.php | 7 +++++-- tests/IntegrationPoolTest.php | 4 ++++ 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index d5f58a9..9e28a78 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,19 @@ -# Apc PSR-6 adapter -[![Build Status](https://travis-ci.org/php-cache/apc-adapter.svg?branch=master)](https://travis-ci.org/php-cache/apc-adapter) [![codecov.io](https://codecov.io/github/php-cache/apc-adapter/coverage.svg?branch=master)](https://codecov.io/github/php-cache/apc-adapter?branch=master) +# Apc PSR-6 Cache pool +[![Latest Stable Version](https://poser.pugx.org/cache/apc-adapter/v/stable)](https://packagist.org/packages/cache/apc-adapter) [![codecov.io](https://codecov.io/github/php-cache/apc-adapter/coverage.svg?branch=master)](https://codecov.io/github/php-cache/apc-adapter?branch=master) [![Build Status](https://travis-ci.org/php-cache/apc-adapter.svg?branch=master)](https://travis-ci.org/php-cache/apc-adapter) [![Total Downloads](https://poser.pugx.org/cache/apc-adapter/downloads)](https://packagist.org/packages/cache/apc-adapter) [![Monthly Downloads](https://poser.pugx.org/cache/apc-adapter/d/monthly.png)](https://packagist.org/packages/cache/apc-adapter) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) -This is a implementation for the PSR-6 for an apc cache. This implementation supports tags. +This is a PSR-6 cache implementation using Apc. It is a part of the PHP Cache organisation. To read about +features like tagging and hierarchy support please read the shared documentation at [www.php-cache.com](http://www.php-cache.com). -| Feature | Supported | -| ------- | --------- | -| Flush everything | Yes -| Expiration time | Yes -| Tagging | Yes +### Install + +```bash +composer require cache/apc-adapter +``` + +### Configure + +You do not need to do any configuration to use the `ApcCachePool`. + +```php +$pool = new ApcCachePool(); +``` diff --git a/composer.json b/composer.json index 8df60d8..f3b2525 100644 --- a/composer.json +++ b/composer.json @@ -29,14 +29,14 @@ { "php": "^5.5", "ext-apc": "*", - "psr/cache": "1.0.0", - "cache/adapter-common": "^0.1", - "cache/taggable-cache": "^0.2" + "psr/cache": "~1.0", + "cache/adapter-common": "^0.2", + "cache/taggable-cache": "^0.3" }, "require-dev": { "phpunit/phpunit": "^5.1|^4.0", - "cache/integration-tests": "dev-master" + "cache/integration-tests": "^0.7" }, "provide": { diff --git a/src/ApcCachePool.php b/src/ApcCachePool.php index 711ff1e..84abebf 100644 --- a/src/ApcCachePool.php +++ b/src/ApcCachePool.php @@ -21,7 +21,10 @@ class ApcCachePool extends AbstractCachePool { protected function fetchObjectFromCache($key) { - return apc_fetch($key); + $success = false; + $data = apc_fetch($key, $success); + + return [$success, $data]; } protected function clearAllObjectsFromCache() @@ -38,6 +41,6 @@ protected function clearOneObjectFromCache($key) protected function storeItemInCache($key, CacheItemInterface $item, $ttl) { - return apc_store($key, $item, $ttl); + return apc_store($key, $item->get(), $ttl); } } diff --git a/tests/IntegrationPoolTest.php b/tests/IntegrationPoolTest.php index 5dcf8cc..fdb7f31 100644 --- a/tests/IntegrationPoolTest.php +++ b/tests/IntegrationPoolTest.php @@ -16,6 +16,10 @@ class IntegrationPoolTest extends BaseTest { + protected $skippedTests = [ + 'testExpiration' => 'The cache expire at the next request.', + ]; + public function createCachePool() { return new ApcCachePool();