Skip to content

Commit

Permalink
Merge pull request #2 from php-cache/patch
Browse files Browse the repository at this point in the history
Updated to the lastes version of tagging and adapter common
  • Loading branch information
Nyholm committed Jan 19, 2016
2 parents 76c3103 + 9200e21 commit 79f884f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -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();
```
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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":
{
Expand Down
7 changes: 5 additions & 2 deletions src/ApcCachePool.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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);
}
}
4 changes: 4 additions & 0 deletions tests/IntegrationPoolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

class IntegrationPoolTest extends BaseTest
{
protected $skippedTests = [
'testExpiration' => 'The cache expire at the next request.',
];

public function createCachePool()
{
return new ApcCachePool();
Expand Down

0 comments on commit 79f884f

Please sign in to comment.