Skip to content

Commit 79f884f

Browse files
committed
Merge pull request #2 from php-cache/patch
Updated to the lastes version of tagging and adapter common
2 parents 76c3103 + 9200e21 commit 79f884f

File tree

4 files changed

+30
-14
lines changed

4 files changed

+30
-14
lines changed

README.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1-
# Apc PSR-6 adapter
2-
[![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)
1+
# Apc PSR-6 Cache pool
2+
[![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)
33

4-
This is a implementation for the PSR-6 for an apc cache. This implementation supports tags.
4+
This is a PSR-6 cache implementation using Apc. It is a part of the PHP Cache organisation. To read about
5+
features like tagging and hierarchy support please read the shared documentation at [www.php-cache.com](http://www.php-cache.com).
56

6-
| Feature | Supported |
7-
| ------- | --------- |
8-
| Flush everything | Yes
9-
| Expiration time | Yes
10-
| Tagging | Yes
7+
### Install
8+
9+
```bash
10+
composer require cache/apc-adapter
11+
```
12+
13+
### Configure
14+
15+
You do not need to do any configuration to use the `ApcCachePool`.
16+
17+
```php
18+
$pool = new ApcCachePool();
19+
```

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@
2929
{
3030
"php": "^5.5",
3131
"ext-apc": "*",
32-
"psr/cache": "1.0.0",
33-
"cache/adapter-common": "^0.1",
34-
"cache/taggable-cache": "^0.2"
32+
"psr/cache": "~1.0",
33+
"cache/adapter-common": "^0.2",
34+
"cache/taggable-cache": "^0.3"
3535
},
3636
"require-dev":
3737
{
3838
"phpunit/phpunit": "^5.1|^4.0",
39-
"cache/integration-tests": "dev-master"
39+
"cache/integration-tests": "^0.7"
4040
},
4141
"provide":
4242
{

src/ApcCachePool.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ class ApcCachePool extends AbstractCachePool
2121
{
2222
protected function fetchObjectFromCache($key)
2323
{
24-
return apc_fetch($key);
24+
$success = false;
25+
$data = apc_fetch($key, $success);
26+
27+
return [$success, $data];
2528
}
2629

2730
protected function clearAllObjectsFromCache()
@@ -38,6 +41,6 @@ protected function clearOneObjectFromCache($key)
3841

3942
protected function storeItemInCache($key, CacheItemInterface $item, $ttl)
4043
{
41-
return apc_store($key, $item, $ttl);
44+
return apc_store($key, $item->get(), $ttl);
4245
}
4346
}

tests/IntegrationPoolTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
class IntegrationPoolTest extends BaseTest
1818
{
19+
protected $skippedTests = [
20+
'testExpiration' => 'The cache expire at the next request.',
21+
];
22+
1923
public function createCachePool()
2024
{
2125
return new ApcCachePool();

0 commit comments

Comments
 (0)