PK ZLQ
LICENSE.mdnu ٘ Copyright (c) 2019-2020, Laminas Foundation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of Laminas Foundation nor the names of its contributors may
be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PK ZLQ%'\ \ COPYRIGHT.mdnu ٘ Copyright (c) 2019-2020, Laminas Foundation.
All rights reserved. (https://getlaminas.org/)
PK ZLQT .travis.ymlnu ٘ language: php
cache:
directories:
- $HOME/.composer/cache
env:
global:
- COMPOSER_ARGS="--no-interaction"
- COVERAGE_DEPS="php-coveralls/php-coveralls"
matrix:
fast_finish: true
include:
- php: 5.6
env:
- DEPS=lowest
- php: 5.6
env:
- DEPS=latest
- php: 7.0
env:
- DEPS=lowest
- php: 7.0
env:
- DEPS=latest
- php: 7.1
env:
- DEPS=lowest
- php: 7.1
env:
- DEPS=latest
- php: 7.2
env:
- DEPS=lowest
- php: 7.2
env:
- DEPS=latest
- php: 7.3
env:
- DEPS=lowest
- php: 7.3
env:
- DEPS=latest
- php: 7.4
env:
- DEPS=lowest
- php: 7.4
env:
- DEPS=latest
- CS_CHECK=true
- TEST_COVERAGE=true
before_install:
- if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
install:
- travis_retry composer install $COMPOSER_ARGS --ignore-platform-reqs
- if [[ $DEPS == 'latest' ]]; then travis_retry composer update $COMPOSER_ARGS ; fi
- if [[ $DEPS == 'lowest' ]]; then travis_retry composer update --prefer-lowest --prefer-stable $COMPOSER_ARGS ; fi
- if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry composer require --dev $COMPOSER_ARGS $COVERAGE_DEPS ; fi
- stty cols 120 && composer show
script:
- if [[ $TEST_COVERAGE == 'true' ]]; then composer run-script test-coverage -- --verbose ; else composer run-script test -- --verbose ; fi
- if [[ $CS_CHECK == 'true' ]]; then composer cs-check ; fi
after_script:
- if [[ $TEST_COVERAGE == 'true' ]]; then travis_retry vendor/bin/php-coveralls -v ; fi
notifications:
email: false
PK ZLQx= = .coveralls.ymlnu ٘ coverage_clover: clover.xml
json_path: coveralls-upload.json
PK ZLQ}CC phpcs.xmlnu ٘
src
test
PK ZLQc
v v README.mdnu ٘ # laminas-cache-storage-adapter-zend-server
[![Build Status](https://travis-ci.com/laminas/laminas-cache-storage-adapter-zend-server.svg?branch=master)](https://travis-ci.com/laminas/laminas-cache-storage-adapter-zend-server)
[![Coverage Status](https://coveralls.io/repos/github/laminas/laminas-cache-storage-adapter-zend-server/badge.svg?branch=master)](https://coveralls.io/github/laminas/laminas-cache-storage-adapter-zend-server?branch=master)
This library provides …
## Installation
Run the following to install this library:
```bash
$ composer require laminas/laminas-cache-storage-adapter-zend-server
```
## Documentation
Browse the documentation online at https://docs.laminas.dev/laminas-cache-storage-adapter-zend-server/
## Support
* [Issues](https://github.com/laminas/laminas-cache-storage-adapter-zend-server/issues/)
* [Forum](https://discourse.laminas.dev/)
PK ZLQfj j
.gitignorenu ٘ /.phpunit.result.cache
/composer.lock
/docs/html/
/laminas-mkdoc-theme.tgz
/laminas-mkdoc-theme/
/vendor/
PK ZLQ src/AbstractZendServer.phpnu ٘ getOptions()->getNamespace();
$prefix = ($namespace === '') ? '' : $namespace . self::NAMESPACE_SEPARATOR;
$result = $this->zdcFetch($prefix . $normalizedKey);
if ($result === false) {
$result = null;
$success = false;
} else {
$success = true;
$casToken = $result;
}
return $result;
}
/**
* Internal method to get multiple items.
*
* @param array $normalizedKeys
* @return array Associative array of keys and values
* @throws Exception\ExceptionInterface
*/
protected function internalGetItems(array & $normalizedKeys)
{
$namespace = $this->getOptions()->getNamespace();
if ($namespace === '') {
return $this->zdcFetchMulti($normalizedKeys);
}
$prefix = $namespace . self::NAMESPACE_SEPARATOR;
$internalKeys = [];
foreach ($normalizedKeys as $normalizedKey) {
$internalKeys[] = $prefix . $normalizedKey;
}
$fetch = $this->zdcFetchMulti($internalKeys);
$result = [];
$prefixL = strlen($prefix);
foreach ($fetch as $k => & $v) {
$result[substr($k, $prefixL)] = $v;
}
return $result;
}
/**
* Internal method to test if an item exists.
*
* @param string $normalizedKey
* @return bool
* @throws Exception\ExceptionInterface
*/
protected function internalHasItem(& $normalizedKey)
{
$namespace = $this->getOptions()->getNamespace();
$prefix = ($namespace === '') ? '' : $namespace . self::NAMESPACE_SEPARATOR;
return ($this->zdcFetch($prefix . $normalizedKey) !== false);
}
/**
* Internal method to test multiple items.
*
* @param array $normalizedKeys
* @return array Array of found keys
* @throws Exception\ExceptionInterface
*/
protected function internalHasItems(array & $normalizedKeys)
{
$namespace = $this->getOptions()->getNamespace();
if ($namespace === '') {
return array_keys($this->zdcFetchMulti($normalizedKeys));
}
$prefix = $namespace . self::NAMESPACE_SEPARATOR;
$internalKeys = [];
foreach ($normalizedKeys as $normalizedKey) {
$internalKeys[] = $prefix . $normalizedKey;
}
$fetch = $this->zdcFetchMulti($internalKeys);
$result = [];
$prefixL = strlen($prefix);
foreach ($fetch as $internalKey => & $value) {
$result[] = substr($internalKey, $prefixL);
}
return $result;
}
/**
* Get metadata for multiple items
*
* @param array $normalizedKeys
* @return array Associative array of keys and metadata
*
* @triggers getMetadatas.pre(PreEvent)
* @triggers getMetadatas.post(PostEvent)
* @triggers getMetadatas.exception(ExceptionEvent)
*/
protected function internalGetMetadatas(array & $normalizedKeys)
{
$namespace = $this->getOptions()->getNamespace();
if ($namespace === '') {
$result = $this->zdcFetchMulti($normalizedKeys);
return array_fill_keys(array_keys($result), []);
}
$prefix = $namespace . self::NAMESPACE_SEPARATOR;
$internalKeys = [];
foreach ($normalizedKeys as $normalizedKey) {
$internalKeys[] = $prefix . $normalizedKey;
}
$fetch = $this->zdcFetchMulti($internalKeys);
$result = [];
$prefixL = strlen($prefix);
foreach ($fetch as $internalKey => $value) {
$result[substr($internalKey, $prefixL)] = [];
}
return $result;
}
/* writing */
/**
* Internal method to store an item.
*
* @param string $normalizedKey
* @param mixed $value
* @return bool
* @throws Exception\ExceptionInterface
*/
protected function internalSetItem(& $normalizedKey, & $value)
{
$options = $this->getOptions();
$namespace = $options->getNamespace();
$prefix = ($namespace === '') ? '' : $namespace . self::NAMESPACE_SEPARATOR;
$this->zdcStore($prefix . $normalizedKey, $value, $options->getTtl());
return true;
}
/**
* Internal method to remove an item.
*
* @param string $normalizedKey
* @return bool
* @throws Exception\ExceptionInterface
*/
protected function internalRemoveItem(& $normalizedKey)
{
$namespace = $this->getOptions()->getNamespace();
$prefix = ($namespace === '') ? '' : $namespace . self::NAMESPACE_SEPARATOR;
return $this->zdcDelete($prefix . $normalizedKey);
}
/* status */
/**
* Internal method to get capabilities of this adapter
*
* @return Capabilities
*/
protected function internalGetCapabilities()
{
if ($this->capabilities === null) {
$this->capabilityMarker = new stdClass();
$this->capabilities = new Capabilities(
$this,
$this->capabilityMarker,
[
'supportedDatatypes' => [
'NULL' => true,
'boolean' => true,
'integer' => true,
'double' => true,
'string' => true,
'array' => true,
'object' => 'object',
'resource' => false,
],
'supportedMetadata' => [],
'minTtl' => 1,
'maxTtl' => 0,
'staticTtl' => true,
'ttlPrecision' => 1,
'useRequestTime' => false,
'lockOnExpire' => ini_get('zend_datacache.lock_on_expire') ? 120 : 0,
'maxKeyLength' => 0,
'namespaceIsPrefix' => true,
'namespaceSeparator' => self::NAMESPACE_SEPARATOR,
]
);
}
return $this->capabilities;
}
/* internal wrapper of zend_[disk|shm]_cache_* functions */
/**
* Store data into Zend Data Cache (zdc)
*
* @param string $internalKey
* @param mixed $value
* @param int $ttl
* @return void
* @throws Exception\RuntimeException
*/
abstract protected function zdcStore($internalKey, $value, $ttl);
/**
* Fetch a single item from Zend Data Cache (zdc)
*
* @param string $internalKey
* @return mixed The stored value or FALSE if item wasn't found
* @throws Exception\RuntimeException
*/
abstract protected function zdcFetch($internalKey);
/**
* Fetch multiple items from Zend Data Cache (zdc)
*
* @param array $internalKeys
* @return array All found items
* @throws Exception\RuntimeException
*/
abstract protected function zdcFetchMulti(array $internalKeys);
/**
* Delete data from Zend Data Cache (zdc)
*
* @param string $internalKey
* @return bool
* @throws Exception\RuntimeException
*/
abstract protected function zdcDelete($internalKey);
}
PK ZLQ@ src/ZendServerShm.phpnu ٘ , {$ttl}) failed"
);
}
}
/**
* Fetch a single item from Zend Data SHM Cache
*
* @param string $internalKey
* @return mixed The stored value or FALSE if item wasn't found
* @throws Exception\RuntimeException
*/
protected function zdcFetch($internalKey)
{
return zend_shm_cache_fetch((string) $internalKey);
}
/**
* Fetch multiple items from Zend Data SHM Cache
*
* @param array $internalKeys
* @return array All found items
* @throws Exception\RuntimeException
*/
protected function zdcFetchMulti(array $internalKeys)
{
$items = zend_shm_cache_fetch($internalKeys);
if ($items === false) {
throw new Exception\RuntimeException("zend_shm_cache_fetch() failed");
}
return $items;
}
/**
* Delete data from Zend Data SHM Cache
*
* @param string $internalKey
* @return bool
* @throws Exception\RuntimeException
*/
protected function zdcDelete($internalKey)
{
return zend_shm_cache_delete($internalKey);
}
}
PK ZLQ2c src/ZendServerDisk.phpnu ٘ totalSpace === null) {
$path = ini_get('zend_datacache.disk.save_path');
ErrorHandler::start();
$total = disk_total_space($path);
$error = ErrorHandler::stop();
if ($total === false) {
throw new Exception\RuntimeException("Can't detect total space of '{$path}'", 0, $error);
}
$this->totalSpace = $total;
}
return $this->totalSpace;
}
/* AvailableSpaceCapableInterface */
/**
* Get available space in bytes
*
* @throws Exception\RuntimeException
* @return int|float
*/
public function getAvailableSpace()
{
$path = ini_get('zend_datacache.disk.save_path');
ErrorHandler::start();
$avail = disk_free_space($path);
$error = ErrorHandler::stop();
if ($avail === false) {
throw new Exception\RuntimeException("Can't detect free space of '{$path}'", 0, $error);
}
return $avail;
}
/* internal */
/**
* Store data into Zend Data Disk Cache
*
* @param string $internalKey
* @param mixed $value
* @param int $ttl
* @return void
* @throws Exception\RuntimeException
*/
protected function zdcStore($internalKey, $value, $ttl)
{
if (! zend_disk_cache_store($internalKey, $value, $ttl)) {
$valueType = gettype($value);
throw new Exception\RuntimeException(
"zend_disk_cache_store($internalKey, <{$valueType}>, {$ttl}) failed"
);
}
}
/**
* Fetch a single item from Zend Data Disk Cache
*
* @param string $internalKey
* @return mixed The stored value or FALSE if item wasn't found
* @throws Exception\RuntimeException
*/
protected function zdcFetch($internalKey)
{
return zend_disk_cache_fetch((string) $internalKey);
}
/**
* Fetch multiple items from Zend Data Disk Cache
*
* @param array $internalKeys
* @return array All found items
* @throws Exception\RuntimeException
*/
protected function zdcFetchMulti(array $internalKeys)
{
$items = zend_disk_cache_fetch($internalKeys);
if ($items === false) {
throw new Exception\RuntimeException("zend_disk_cache_fetch() failed");
}
return $items;
}
/**
* Delete data from Zend Data Disk Cache
*
* @param string $internalKey
* @return bool
* @throws Exception\RuntimeException
*/
protected function zdcDelete($internalKey)
{
return zend_disk_cache_delete($internalKey);
}
}
PK ZLQ
mkdocs.ymlnu ٘ docs_dir: docs/book
site_dir: docs/html
nav:
- Home: index.md
- Introduction: v1/intro.md
site_name: 'laminas-cache-storage-adapter-zend-server'
site_description: ''
repo_url: 'https://github.com/laminas/laminas-cache-storage-adapter-zend-server'
PK ZLQu|e)
1 .github/workflows/release-on-milestone-closed.ymlnu ٘ # Alternate workflow example.
# This one is identical to the one in release-on-milestone.yml, with one change:
# the Release step uses the ORGANIZATION_ADMIN_TOKEN instead, to allow it to
# trigger a release workflow event. This is useful if you have other actions
# that intercept that event.
name: "Automatic Releases"
on:
milestone:
types:
- "closed"
jobs:
release:
name: "GIT tag, release & create merge-up PR"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
- name: "Release"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:release"
env:
"GITHUB_TOKEN": ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}
- name: "Create Merge-Up Pull Request"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:create-merge-up-pull-request"
env:
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}
- name: "Create and/or Switch to new Release Branch"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:switch-default-branch-to-next-minor"
env:
"GITHUB_TOKEN": ${{ secrets.ORGANIZATION_ADMIN_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}
- name: "Bump Changelog Version On Originating Release Branch"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:bump-changelog"
env:
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}
- name: "Create new milestones"
uses: "laminas/automatic-releases@v1"
with:
command-name: "laminas:automatic-releases:create-milestones"
env:
"GITHUB_TOKEN": ${{ secrets.GITHUB_TOKEN }}
"SIGNING_SECRET_KEY": ${{ secrets.SIGNING_SECRET_KEY }}
"GIT_AUTHOR_NAME": ${{ secrets.GIT_AUTHOR_NAME }}
"GIT_AUTHOR_EMAIL": ${{ secrets.GIT_AUTHOR_EMAIL }}
PK ZLQRa .gitattributesnu ٘ /.coveralls.yml export-ignore
/.gitattributes export-ignore
/.github/ export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/docs/ export-ignore
/mkdocs.yml export-ignore
/phpcs.xml export-ignore
/phpunit.xml.dist export-ignore
/test/ export-ignore
PK ZLQ:[ B test/integration/Psr/SimpleCache/ZendServerDiskIntegrationTest.phpnu ٘ tz = date_default_timezone_get();
date_default_timezone_set('America/Vancouver');
parent::setUp();
}
protected function tearDown()
{
date_default_timezone_set($this->tz);
if (function_exists('zend_disk_cache_clear')) {
zend_disk_cache_clear();
}
parent::tearDown();
}
public function createSimpleCache()
{
try {
$storage = StorageFactory::adapterFactory('zendserverdisk');
return new SimpleCacheDecorator($storage);
} catch (Exception\ExtensionNotLoadedException $e) {
$this->markTestSkipped($e->getMessage());
} catch (ServiceNotCreatedException $e) {
if ($e->getPrevious() instanceof Exception\ExtensionNotLoadedException) {
$this->markTestSkipped($e->getMessage());
}
throw $e;
}
}
}
PK ZLQ?~S S A test/integration/Psr/SimpleCache/ZendServerShmIntegrationTest.phpnu ٘ markTestSkipped("Missing 'zend_shm_cache_*' functions or running from SAPI 'cli'");
}
// set non-UTC timezone
$this->tz = date_default_timezone_get();
date_default_timezone_set('America/Vancouver');
parent::setUp();
}
protected function tearDown()
{
date_default_timezone_set($this->tz);
if (function_exists('zend_shm_cache_clear')) {
zend_disk_cache_clear();
}
parent::tearDown();
}
public function createSimpleCache()
{
try {
$storage = StorageFactory::adapterFactory('zendservershm');
return new SimpleCacheDecorator($storage);
} catch (Exception\ExtensionNotLoadedException $e) {
$this->markTestSkipped($e->getMessage());
} catch (ServiceNotCreatedException $e) {
if ($e->getPrevious() instanceof Exception\ExtensionNotLoadedException) {
$this->markTestSkipped($e->getMessage());
}
throw $e;
}
}
}
PK ZLQԾ> D test/integration/Psr/CacheItemPool/ZendServerDiskIntegrationTest.phpnu ٘ tz = date_default_timezone_get();
date_default_timezone_set('America/Vancouver');
parent::setUp();
}
protected function tearDown()
{
date_default_timezone_set($this->tz);
if (function_exists('zend_disk_cache_clear')) {
zend_disk_cache_clear();
}
parent::tearDown();
}
public function createCachePool()
{
try {
$storage = StorageFactory::adapterFactory('zendserverdisk');
$deferredSkippedMessage = sprintf(
'%s storage doesn\'t support driver deferred',
\get_class($storage)
);
$this->skippedTests['testHasItemReturnsFalseWhenDeferredItemIsExpired'] = $deferredSkippedMessage;
return new CacheItemPoolDecorator($storage);
} catch (Exception\ExtensionNotLoadedException $e) {
$this->markTestSkipped($e->getMessage());
} catch (ServiceNotCreatedException $e) {
if ($e->getPrevious() instanceof Exception\ExtensionNotLoadedException) {
$this->markTestSkipped($e->getMessage());
}
throw $e;
}
}
}
PK ZLQ&ִh h C test/integration/Psr/CacheItemPool/ZendServerShmIntegrationTest.phpnu ٘ markTestSkipped("Missing 'zend_shm_cache_*' functions or running from SAPI 'cli'");
}
// set non-UTC timezone
$this->tz = date_default_timezone_get();
date_default_timezone_set('America/Vancouver');
parent::setUp();
}
protected function tearDown()
{
date_default_timezone_set($this->tz);
if (function_exists('zend_shm_cache_clear')) {
zend_disk_cache_clear();
}
parent::tearDown();
}
public function createCachePool()
{
try {
$storage = StorageFactory::adapterFactory('zendservershm');
$deferredSkippedMessage = sprintf(
'%s storage doesn\'t support driver deferred',
\get_class($storage)
);
$this->skippedTests['testHasItemReturnsFalseWhenDeferredItemIsExpired'] = $deferredSkippedMessage;
return new CacheItemPoolDecorator($storage);
} catch (Exception\ExtensionNotLoadedException $e) {
$this->markTestSkipped($e->getMessage());
} catch (ServiceNotCreatedException $e) {
if ($e->getPrevious() instanceof Exception\ExtensionNotLoadedException) {
$this->markTestSkipped($e->getMessage());
}
throw $e;
}
}
}
PK ZLQx test/unit/ZendServerDiskTest.phpnu ٘
*/
class ZendServerDiskTest extends CommonAdapterTest
{
public function setUp()
{
if (! function_exists('zend_disk_cache_store') || PHP_SAPI == 'cli') {
try {
new Cache\Storage\Adapter\ZendServerDisk();
$this->fail("Missing expected ExtensionNotLoadedException");
} catch (Exception\ExtensionNotLoadedException $e) {
$this->markTestSkipped($e->getMessage());
}
}
$this->_options = new Cache\Storage\Adapter\AdapterOptions();
$this->_storage = new Cache\Storage\Adapter\ZendServerDisk($this->_options);
parent::setUp();
}
public function tearDown()
{
if (function_exists('zend_disk_cache_clear')) {
zend_disk_cache_clear();
}
parent::tearDown();
}
public function getCommonAdapterNamesProvider()
{
return [
['zend_server_disk'],
['zendserverdisk'],
['ZendServerDisk'],
['zendServerDisk'],
];
}
}
PK ZLQ탠h $ test/unit/AbstractZendServerTest.phpnu ٘
*/
class AbstractZendServerTest extends TestCase
{
public function setUp()
{
$this->_options = new AdapterOptions();
$this->_storage = $this->getMockForAbstractClass(
'Laminas\Cache\Storage\Adapter\AbstractZendServer',
[],
'',
true,
true,
true,
['getOptions']
);
$this->_storage->setOptions($this->_options);
$this->_storage->expects($this->any())
->method('getOptions')
->will($this->returnValue($this->_options));
}
public function testGetOptions()
{
$options = $this->_storage->getOptions();
$this->assertInstanceOf('Laminas\Cache\Storage\Adapter\AdapterOptions', $options);
$this->assertInternalType('boolean', $options->getWritable());
$this->assertInternalType('boolean', $options->getReadable());
$this->assertInternalType('integer', $options->getTtl());
$this->assertInternalType('string', $options->getNamespace());
$this->assertInternalType('string', $options->getKeyPattern());
}
public function testGetItem()
{
$this->_options->setNamespace('ns');
$this->_storage->expects($this->once())
->method('zdcFetch')
->with($this->equalTo('ns' . AbstractZendServer::NAMESPACE_SEPARATOR . 'key'))
->will($this->returnValue('value'));
$this->assertEquals('value', $this->_storage->getItem('key'));
}
public function testGetItemFailed()
{
$success = null;
$this->_options->setNamespace('ns');
$this->_storage->expects($this->once())
->method('zdcFetch')
->with($this->equalTo('ns' . AbstractZendServer::NAMESPACE_SEPARATOR . 'key'))
->will($this->returnValue(false));
$this->assertNull($this->_storage->getItem('key', $success));
$this->assertFalse($success);
}
public function testGetMetadata()
{
$this->_options->setNamespace('ns');
$this->_storage->expects($this->once())
->method('zdcFetch')
->with($this->equalTo('ns' . AbstractZendServer::NAMESPACE_SEPARATOR . 'key'))
->will($this->returnValue('value'));
$this->assertEquals([], $this->_storage->getMetadata('key'));
}
public function testHasItem()
{
$this->_options->setNamespace('ns');
$this->_storage->expects($this->once())
->method('zdcFetch')
->with($this->equalTo('ns' . AbstractZendServer::NAMESPACE_SEPARATOR . 'key'))
->will($this->returnValue('value'));
$this->assertEquals(true, $this->_storage->hasItem('key'));
}
public function testSetItem()
{
$this->_options->setTtl(10);
$this->_options->setNamespace('ns');
$this->_storage->expects($this->once())
->method('zdcStore')
->with(
$this->equalTo('ns' . AbstractZendServer::NAMESPACE_SEPARATOR . 'key'),
$this->equalTo('value'),
$this->equalTo(10)
)
->will($this->returnValue(true));
$this->assertEquals(true, $this->_storage->setItem('key', 'value'));
}
public function testRemoveItem()
{
$this->_options->setNamespace('ns');
$this->_storage->expects($this->once())
->method('zdcDelete')
->with($this->equalTo('ns' . AbstractZendServer::NAMESPACE_SEPARATOR . 'key'))
->will($this->returnValue(true));
$this->assertEquals(true, $this->_storage->removeItem('key'));
}
}
PK ZLQs test/unit/ZendServerShmTest.phpnu ٘
*/
class ZendServerShmTest extends CommonAdapterTest
{
public function setUp()
{
if (strtolower(PHP_SAPI) == 'cli') {
$this->markTestSkipped('Zend Server SHM does not work in CLI environment');
return;
}
if (! function_exists('zend_shm_cache_store')) {
try {
new Cache\Storage\Adapter\ZendServerShm();
$this->fail("Missing expected ExtensionNotLoadedException");
} catch (Exception\ExtensionNotLoadedException $e) {
$this->markTestSkipped($e->getMessage());
}
}
$this->_options = new Cache\Storage\Adapter\AdapterOptions();
$this->_storage = new Cache\Storage\Adapter\ZendServerShm($this->_options);
parent::setUp();
}
public function tearDown()
{
if (function_exists('zend_shm_cache_clear')) {
zend_shm_cache_clear();
}
parent::tearDown();
}
public function getCommonAdapterNamesProvider()
{
return [
['zend_server_shm'],
['zendservershm'],
['ZendServerShm'],
['ZendServerSHM'],
['zendServerShm'],
['zendServerSHM'],
];
}
}
PK ZLQ!~gQ Q phpunit.xml.distnu ٘
./test
./src
PK ZLQW{܄ CHANGELOG.mdnu ٘ # Changelog
All notable changes to this project will be documented in this file, in reverse chronological order by release.
## 1.1.0 - TBD
### Added
- Nothing.
### Changed
- Nothing.
### Deprecated
- Nothing.
### Removed
- Nothing.
### Fixed
- Nothing.
## 1.0.0 - 2020-10-05
This is the initial release of `laminas/laminas-cache-storage-adapter-zend-server`.
**This release does not contain any changes when compared to `laminas/laminas-cache` v2.9!**
-----
### Release Notes for [1.0.0](https://github.com/laminas/laminas-cache-storage-adapter-zend-server/milestone/1)
### 1.0.0
- Total issues resolved: **0**
- Total pull requests resolved: **0**
- Total contributors: **0**
PK ZLQL>X X
composer.jsonnu ٘ {
"name": "laminas/laminas-cache-storage-adapter-zend-server",
"description": "Laminas cache adapter for zend-server",
"keywords": [
"laminas",
"cache"
],
"license": "BSD-3-Clause",
"require": {
"php": "^5.6 || ^7.0",
"laminas/laminas-cache": "^2.10@dev"
},
"provide": {
"laminas/laminas-cache-storage-implementation": "1.0"
},
"require-dev": {
"laminas/laminas-cache-storage-adapter-test": "^1.0@dev",
"laminas/laminas-coding-standard": "~1.0.0",
"squizlabs/php_codesniffer": "^2.7"
},
"config": {
"sort-packages": true
},
"extra": {
},
"autoload": {
"psr-4": {
"Laminas\\Cache\\Storage\\Adapter\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"LaminasTest\\Cache\\Storage\\Adapter\\": "test/unit",
"LaminasTest\\Cache\\Psr\\": "test/integration/Psr"
}
},
"scripts": {
"cs-check": "phpcs",
"cs-fix": "phpcbf",
"test": "phpunit --colors=always",
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml"
},
"support": {
"issues": "https://github.com/laminas/laminas-cache-storage-adapter-zend-server/issues",
"forum": "https://discourse.laminas.dev/",
"source": "https://github.com/laminas/laminas-cache-storage-adapter-zend-server",
"docs": "https://docs.laminas.dev/laminas-cache-storage-adapter-zend-server/",
"rss": "https://github.com/laminas/laminas-cache-storage-adapter-zend-server/releases.atom"
}
}
PK ZLQ
7uI I docs/book/v1/intro.mdnu ٘ # laminas-cache-storage-adapter-zend-server
This component provides ...
PK ZLQ
LICENSE.mdnu ٘ PK ZLQ%'\ \ COPYRIGHT.mdnu ٘ PK ZLQT .travis.ymlnu ٘ PK ZLQx= =
.coveralls.ymlnu ٘ PK ZLQ}CC # phpcs.xmlnu ٘ PK ZLQc
v v 8 README.mdnu ٘ PK ZLQfj j
.gitignorenu ٘ PK ZLQ src/AbstractZendServer.phpnu ٘ PK ZLQ@ 4 src/ZendServerShm.phpnu ٘ PK ZLQ2c C src/ZendServerDisk.phpnu ٘ PK ZLQ
aW mkdocs.ymlnu ٘ PK ZLQu|e)
1 X .github/workflows/release-on-milestone-closed.ymlnu ٘ PK ZLQRa c .gitattributesnu ٘ PK ZLQ:[ B d test/integration/Psr/SimpleCache/ZendServerDiskIntegrationTest.phpnu ٘ PK ZLQ?~S S A l test/integration/Psr/SimpleCache/ZendServerShmIntegrationTest.phpnu ٘ PK ZLQԾ> D s test/integration/Psr/CacheItemPool/ZendServerDiskIntegrationTest.phpnu ٘ PK ZLQ&ִh h C { test/integration/Psr/CacheItemPool/ZendServerShmIntegrationTest.phpnu ٘ PK ZLQx test/unit/ZendServerDiskTest.phpnu ٘ PK ZLQ탠h $ test/unit/AbstractZendServerTest.phpnu ٘ PK ZLQs test/unit/ZendServerShmTest.phpnu ٘ PK ZLQ!~gQ Q phpunit.xml.distnu ٘ PK ZLQW{܄ CHANGELOG.mdnu ٘ PK ZLQL>X X
~ composer.jsonnu ٘ PK ZLQ
7uI I docs/book/v1/intro.mdnu ٘ PK