Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 9561605

Browse files
committed
Updated integration-tests dep to 0.8.0, added check for useRequestTime = true and disabled XCache as a result
1 parent a5cc0fd commit 9561605

24 files changed

+60
-80
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"require-dev": {
2323
"zendframework/zend-serializer": "^2.6",
2424
"zendframework/zend-session": "^2.5",
25-
"cache/integration-tests": "^0.7.0",
25+
"cache/integration-tests": "^0.8.0",
2626
"fabpot/php-cs-fixer": "1.7.*",
2727
"phpunit/PHPUnit": "~4.0"
2828
},

doc/book/zend.cache.psr.cacheitempooladapter.md renamed to doc/book/psr6.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ found.
5151
## Supported adapters
5252

5353
The PSR-6 specification requires that the underlying storage support time-to-live (TTL), which is set when the
54-
item is saved. For this reason the following adapters cannot be used: `Dba`, `Filesystem`, `Memory` and `Session`.
54+
item is saved. For this reason the following adapters cannot be used: `Dba`, `Filesystem`, `Memory` and `Session`. The
55+
`XCache` adapter calculates TTLs based on the request time, not the time the item is actually persisted, which means
56+
that it also cannot be used.
5557

5658
In addition adapters must support the `Zend\Cache\FlushableInterface`. All the current `Zend\Cache\Storage\Adapter`s
5759
fulfil this requirement.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pages:
1313
- ObjectCache: pattern/object-cache.md
1414
- OutputCache: pattern/output-cache.md
1515
- CaptureCache: pattern/capture-cache.md
16+
- PSR-6: psr6.md
1617
site_name: zend-cache
1718
site_description: Zend\Cache
1819
repo_url: 'https://github.com/zendframework/zend-cache'

src/Psr/CacheException.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* @copyright Copyright (c) 2016 Zend Technologies USA Inc. (http://www.zend.com)
77
* @license http://framework.zend.com/license/new-bsd New BSD License
88
*/
9+
910
namespace Zend\Cache\Psr;
1011

1112
use Psr\Cache\CacheException as CacheExceptionInterface;

src/Psr/CacheItem.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* @copyright Copyright (c) 2016 Zend Technologies USA Inc. (http://www.zend.com)
77
* @license http://framework.zend.com/license/new-bsd New BSD License
88
*/
9+
910
namespace Zend\Cache\Psr;
1011

1112
use DateInterval;

src/Psr/CacheItemPoolAdapter.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use Psr\Cache\CacheItemInterface;
1212
use Psr\Cache\CacheItemPoolInterface;
1313
use Zend\Cache\Exception;
14-
use Zend\Cache\Storage\Adapter\Apc;
1514
use Zend\Cache\Storage\ClearByNamespaceInterface;
1615
use Zend\Cache\Storage\FlushableInterface;
1716
use Zend\Cache\Storage\StorageInterface;
@@ -321,18 +320,18 @@ private function validateStorage(StorageInterface $storage)
321320
));
322321
}
323322

324-
if ($storage instanceof Apc && ini_get('apc.use_request_time')) {
323+
// we've got to be able to set per-item TTL on write
324+
$capabilities = $storage->getCapabilities();
325+
if (!($capabilities->getStaticTtl() && $capabilities->getMinTtl())) {
325326
throw new CacheException(sprintf(
326-
'Cannot use %s with apc.use_request_time = 1',
327+
'Storage %s does not support static TTL',
327328
get_class($storage)
328329
));
329330
}
330331

331-
// we've got to be able to set per-item TTL on write
332-
$capabilities = $storage->getCapabilities();
333-
if (!($capabilities->getStaticTtl() && $capabilities->getMinTtl())) {
332+
if ($capabilities->getUseRequestTime()) {
334333
throw new CacheException(sprintf(
335-
'Storage %s does not support static TTL',
334+
'Cannot use %s with useRequestTime = true',
336335
get_class($storage)
337336
));
338337
}

src/Psr/InvalidArgumentException.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* @copyright Copyright (c) 2016 Zend Technologies USA Inc. (http://www.zend.com)
77
* @license http://framework.zend.com/license/new-bsd New BSD License
88
*/
9+
910
namespace Zend\Cache\Psr;
1011

1112
use Psr\Cache\InvalidArgumentException as InvalidArgumentExceptionInterface;

test/Psr/ApcIntegrationTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* @copyright Copyright (c) 2016 Zend Technologies USA Inc. (http://www.zend.com)
77
* @license http://framework.zend.com/license/new-bsd New BSD License
88
*/
9+
910
namespace ZendTest\Cache\Psr;
1011

1112
use Cache\IntegrationTests\CachePoolTest;

test/Psr/BlackHoleIntegrationTest.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?php
22
/**
3-
* @author matt
4-
* @copyright 2015 Claritum Limited
5-
* @license Commercial
3+
* Zend Framework (http://framework.zend.com/).
4+
*
5+
* @link http://github.com/zendframework/zend-cache for the canonical source repository
6+
* @copyright Copyright (c) 2016 Zend Technologies USA Inc. (http://www.zend.com)
7+
* @license http://framework.zend.com/license/new-bsd New BSD License
68
*/
79

810
namespace ZendTest\Cache\Psr;

test/Psr/CacheItemPoolAdapterTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* @copyright Copyright (c) 2016 Zend Technologies USA Inc. (http://www.zend.com)
77
* @license http://framework.zend.com/license/new-bsd New BSD License
88
*/
9+
910
namespace ZendTest\Cache;
1011

1112
use PHPUnit_Framework_TestCase as TestCase;

0 commit comments

Comments
 (0)